List:MySQL++« Previous MessageNext Message »
From:Simon Pickles Date:December 17 2007 7:59pm
Subject:Re: Linking errors after moving to SSQLSs, macro problem
View as plain text  

Warren Young wrote:
> Simon Pickles wrote:
>>
>> This situation gets an UNKNOWN TYPE for myType 
>
> Post the exact error message text and details about your platform.
>

Sorry for the bad post yesterday - I think I was in a state of some 
confusion/delirium.

Strangely my problem is manifesting itself more clearly today. 
Fundamentally, my problem resides with needing to use the type created 
but sql_create in both the header and source file of the same class.

In my example, I have a class, ClassWithSSQLS, the header of which 
includes ssqls.h (containing the macro 'macro').

The cpp file includes the its corresponding header, but also defines 
*MYSQLPP_SSQLS_NO_STATICS, *as does main.cpp.

A simple 4 file example is available here:

http://members.gamedev.net/sipickles/mysqlppTest.zip

On my g++4.1, on Ubuntu, I get these linker errors:


-------------- Build: Debug in mysqlppTest ---------------

Compiling: main.cpp
Linking console executable: bin/Debug/mysqlppTest
obj/Debug/main.o:(.data+0x0): multiple definition of `macro::names'
obj/Debug/ClassWithSSQLS.o:(.data+0x0): first defined here
obj/Debug/main.o:(.data+0x8): multiple definition of `macro::_table'
obj/Debug/ClassWithSSQLS.o:(.data+0x8): first defined here
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 1 seconds)
0 errors, 0 warnings

This is because both main.cpp and ClassWithSSQLS.cpp need to include 
ClassWithSSQLS.h, since they both use the class ClassWithSSQLS. They 
both define *MYSQLPP_SSQLS_NO_STATICS* since I think ClassWithSSQLS.h is 
the 'owner'.

Note, I've also tried the same file structure but making the 
ClassWithSSQLS.cpp the owner, then using NO_STRUCTS on main.cpp and 
ClassWithSSQLS.h

Exactly the same problem. I imagine there is a gap in my understanding 
which is causing all this!

Thanks for your help.

Simon



Thread
Linking errors after moving to SSQLSs, macro problemSimon Pickles12 Dec
  • Re: Linking errors after moving to SSQLSs, macro problemWilliam F. Dowling12 Dec
Re: Linking errors after moving to SSQLSs, macro problemWarren Young12 Dec
  • Re: Linking errors after moving to SSQLSs, macro problemSimon Pickles16 Dec
Re: Linking errors after moving to SSQLSs, macro problemWarren Young17 Dec
  • Re: Linking errors after moving to SSQLSs, macro problemSimon Pickles17 Dec
Re: Linking errors after moving to SSQLSs, macro problemWarren Young17 Dec
  • Re: Linking errors after moving to SSQLSs, macro problemSimon Pickles17 Dec
RE: Linking errors after moving to SSQLSs, macro problemJoel Fielder17 Dec
  • Re: Linking errors after moving to SSQLSs, macro problemDrew M.18 Dec
  • Re: Linking errors after moving to SSQLSs, macro problemSimon Pickles18 Dec
  • Re: Linking errors after moving to SSQLSs, macro problemWarren Young18 Dec
    • Re: Linking errors after moving to SSQLSs, macro problemJim19 Dec
      • Re: Linking errors after moving to SSQLSs, macro problemWarren Young19 Dec
        • Re: Linking errors after moving to SSQLSs, macro problemJim20 Dec
          • Re: Linking errors after moving to SSQLSs, macro problemWarren Young21 Dec
Re: Linking errors after moving to SSQLSs, macro problemWarren Young18 Dec
  • Re: Linking errors after moving to SSQLSs, macro problemWarren Young18 Dec
    • Re: Linking errors after moving to SSQLSs, macro problemSimon Pickles18 Dec
Re: Linking errors after moving to SSQLSs, macro problemWarren Young18 Dec