20 messages in com.mysql.lists.plusplusRe: Linking errors after moving to SS...| From | Sent On | Attachments |
|---|---|---|
| Simon Pickles | 12 Dec 2007 14:16 | |
| William F. Dowling | 12 Dec 2007 14:26 | |
| Warren Young | 12 Dec 2007 14:34 | |
| Simon Pickles | 16 Dec 2007 14:22 | |
| Warren Young | 17 Dec 2007 05:56 | |
| Simon Pickles | 17 Dec 2007 11:59 | |
| Warren Young | 17 Dec 2007 13:19 | |
| Simon Pickles | 17 Dec 2007 14:11 | |
| Joel Fielder | 17 Dec 2007 14:36 | |
| Drew M. | 17 Dec 2007 15:26 | |
| Simon Pickles | 18 Dec 2007 00:07 | |
| Warren Young | 18 Dec 2007 10:15 | |
| Warren Young | 18 Dec 2007 10:19 | |
| Warren Young | 18 Dec 2007 10:25 | |
| Simon Pickles | 18 Dec 2007 12:42 | |
| Warren Young | 18 Dec 2007 13:47 | |
| Jim | 19 Dec 2007 03:50 | |
| Warren Young | 19 Dec 2007 08:45 | |
| Jim | 20 Dec 2007 03:50 | |
| Warren Young | 20 Dec 2007 18:16 |
| Subject: | Re: Linking errors after moving to SSQLSs, macro problem![]() |
|---|---|
| From: | William F. Dowling (will...@thomson.com) |
| Date: | 12/12/2007 02:26:07 PM |
| List: | com.mysql.lists.plusplus |
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 will...@thomson.com www.scientific.thomson.com




