Simon Pickles wrote:
>
> I need to store types defined by the macros as class members.
This is little different than before. Here's your code back, with the
#defines in the right places. Comments with *** in them on each line I
added, or marking interesting things. There are only 3:
// FILE main.cpp ///////////////////////////////////////
#define MYSQLPP_SSQLS_NO_STATICS // *** main.cpp doesn't own it
#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
#define MYSQLPP_SSQLS_NO_STATICS // *** ditto 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 //////////////////////////////////////////
// *** No #define here, because ClassWithSSQLS.cpp *does* own it
// THE CPP IS THE OWNER!
#include "ClassWithSSQLS.h"
ClassWithSSQLS::ClassWithSSQLS()
{
macro m;
}
One .cpp file as owner. That's all.
| 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 |