Warren Young wrote:
>
> MYSQLPP_SSQLS_NO_STATICS doesn't go in the .h file either
>
Thanks for the informative response, Warren. This all works fine if I
only put an
#include "ssqls.h"
... in .cpp files.
Unfortunately, I need to store types defined by the macros as class
members. As soon as I add the above include file to the class header
file so as not to get a type error, it all breaks down with the same
multiple definitions:
-------------- Build: Debug in mysqlppTest ---------------
Compiling: ClassWithSSQLS.cpp
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, 3 seconds)
0 errors, 0 warnings
Here are the files.... does anyone else get the same result?
// FILE main.cpp ///////////////////////////////////////
#include "ClassWithSSQLS.h"
int main()
{
ClassWithSSQLS c;
return 0;
}
// FILE ssqls.h //////////////////////////////////////////
#ifndef SSQLS_H
#define SSQLS_H
#include <mysql++.h>
#include <custom.h>
sql_create_2( macro, 1, 0,
unsigned int, id,
unsigned int, key )
#endif
// FILE ClassWithSSQLS.h ////////////////////////////////////////////
#ifndef CLASSWITHSSQLS_H
#define CLASSWITHSSQLS_H
// H IS NOT OWNER BUT NEEDS TO HAVE macro IN SCOPE SO....
#include "ssqls.h" // << THIS LINE SPOILS THE PARTY :(
class ClassWithSSQLS
{
public:
ClassWithSSQLS();
macro macro_;
};
#endif
// FILE ClassWithSSQLS.cpp //////////////////////////////////////////
// THE CPP IS THE OWNER!
#include "ClassWithSSQLS.h"
ClassWithSSQLS::ClassWithSSQLS()
{
macro m;
}
If anyone can shed any light.. thanks
Simon
| Thread |
|---|
| • Linking errors after moving to SSQLSs, macro problem | Simon Pickles | 12 Dec |
| • Re: Linking errors after moving to SSQLSs, macro problem | William F. Dowling | 12 Dec |
| • Re: Linking errors after moving to SSQLSs, macro problem | Warren Young | 12 Dec |
| • Re: Linking errors after moving to SSQLSs, macro problem | Simon Pickles | 16 Dec |
| • Re: Linking errors after moving to SSQLSs, macro problem | Warren Young | 17 Dec |
| • Re: Linking errors after moving to SSQLSs, macro problem | Simon Pickles | 17 Dec |
| • Re: Linking errors after moving to SSQLSs, macro problem | Warren Young | 17 Dec |
| • Re: Linking errors after moving to SSQLSs, macro problem | Simon Pickles | 17 Dec |
| • RE: Linking errors after moving to SSQLSs, macro problem | Joel Fielder | 17 Dec |
| • Re: Linking errors after moving to SSQLSs, macro problem | Drew M. | 18 Dec |
| • Re: Linking errors after moving to SSQLSs, macro problem | Simon Pickles | 18 Dec |
| • Re: Linking errors after moving to SSQLSs, macro problem | Warren Young | 18 Dec |
| • Re: Linking errors after moving to SSQLSs, macro problem | Jim | 19 Dec |
| • Re: Linking errors after moving to SSQLSs, macro problem | Warren Young | 19 Dec |
| • Re: Linking errors after moving to SSQLSs, macro problem | Jim | 20 Dec |
| • Re: Linking errors after moving to SSQLSs, macro problem | Warren Young | 21 Dec |
| • Re: Linking errors after moving to SSQLSs, macro problem | Warren Young | 18 Dec |
| • Re: Linking errors after moving to SSQLSs, macro problem | Warren Young | 18 Dec |
| • Re: Linking errors after moving to SSQLSs, macro problem | Simon Pickles | 18 Dec |
| • Re: Linking errors after moving to SSQLSs, macro problem | Warren Young | 18 Dec |