One way is
#define SOME_SYMBOL
in just one .cpp file that will include databasesstructs.h.
Then in databasesstructs.h
#ifndef DATABASESTRUCTS_H
#define DATABASESTRUCTS_H
#ifdef SOME_SYMBOL
#include <mysql++.h>
#include <custom.h>
sql_create_4( PlayerSQL, 1, 0,
unsigned int, PLAYER_ID,
std::string, PLAYER_NAME,
unsigned int, PLAYER_OBJECTID,
unsigned int, PLAYER_ZONE );
#endif
#endif
On Wed, 2007-12-12 at 22:16 +0000, Simon Pickles wrote:
> Hi,
>
> My app was building and running without using SSQLS, but seeing the
> simplicity and extra functionality they afford, I moved to SSQLS.
> Unfortunately, this generates a string of linker errors now, due to
> multiple definitions.
>
> This is, I think, because I have declared the SSQLS using a macro in a
> header file. To use the resulting data structure I have been including
> the header file, but this runs the macro repeatedly of course.
>
> Eg:
>
> #ifndef DATABASESTRUCTS_H
> #define DATABASESTRUCTS_H
>
> #include <mysql++.h>
> #include <custom.h>
>
> sql_create_4( PlayerSQL, 1, 0,
> unsigned int, PLAYER_ID,
> std::string, PLAYER_NAME,
> unsigned int, PLAYER_OBJECTID,
> unsigned int, PLAYER_ZONE );
> #endif
>
> What is the correct way to overcome this? I need PlayerManager.cpp and
> Player.cpp to have PlayerSQL in scope.
>
> Thanks
>
> Simon
>
> --
> Linux user #458601 - http://counter.li.org.
>
>
>
>
--
William F Dowling
william.dowling@stripped
www.scientific.thomson.com
| 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 |