3 messages in com.mysql.lists.plusplusLinking issues using create macro in ...
FromSent OnAttachments
MERE...@aol.com26 Apr 2005 04:50 
Warren Young26 Apr 2005 16:17 
Warren Young27 Apr 2005 00:57 
Subject:Linking issues using create macro in header
From:MERE...@aol.com (MERE@aol.com)
Date:04/26/2005 04:50:04 AM
List:com.mysql.lists.plusplus

As previously posted by Chris Gagnon, I have found the reason his compilier complains about "_table" and "name" being multiply defined. Im running into the same trouble. The compiler I am using is VC++ 7.1

When using the create macro, according to the preprocessor, it expands to something like this...

//////////////////////////// ... struct stock { .... static const char *names[]; static const char *_table; ..... };

const char *stock::names[] = { "item" , "num" , "weight" , "price" , "date"}; const char *stock::_table = "stock" ; ... //////////////////////////////

When this is put in a header file, then every where you include that header its gonna try to redefine "names" and "_table".

At least this is my understanding of what is wrong. So i guess the question is, can "sql_create_#" be used in a header file and be included every where you need it?

I had to modify the custom.pl script to not init these members. Instead I am initializing them in my code manually in a global area. Does this seem like a logical solution? Just curious.

Mark Merendino