List:MySQL++« Previous MessageNext Message »
From:William F. Dowling Date:December 12 2007 10:26pm
Subject:Re: Linking errors after moving to SSQLSs, macro problem
View as plain text  
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 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