From: Kevin Smith Date: September 26 2012 4:14am Subject: Problem using the sql_create_# macro in a header file List-Archive: http://lists.mysql.com/plusplus/9536 Message-Id: <002601cd9b9d$713df8f0$53b9ead0$@lapis.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0027_01CD9B7B.EA2D1C40" ------=_NextPart_000_0027_01CD9B7B.EA2D1C40 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hi, I am writing an application where I have created an interface class to the mysql database. The class contains a vector of SSQLS objects which are defined by the sql_create_# macro. I have placed the macro in the header file for the interface class so that the definition of the SSQLS structure is available to the class vector definition. Everything compiles nicely, but when the program is linked, if there are multiple files that include the header, there are multiple definitions of a couple of the functions that are created by the macro. If only one file includes the header, then there are no problems. Do you have a work around for this? MyHeader.h #include #include #include sql_create_5(DBPTrans, 1, 5, mysqlpp::sql_int, trans_id, mysqlpp::sql_datetime, trans_time, mysqlpp::sql_varchar, trans_type, mysqlpp::sql_char, ticket_id, mysqlpp::sql_mediumtext, data); using namespace std; class dbInterface { public: dbInterface (); int pushTransaction (void); bool flush(void); private: bool dbupdateLastTransaction(void); bool dbWriteTransactionList(void); vector < DBPTrans > dbptransvect; }; Support A.cpp #include "MyHeader.h" .. Main.cpp #include "MyHeader.h" .. When Linked, there will be functions in SupportA and Main that are multiply defined, and it happens with sql_create made function. Thanks in advance! -Kevin ------=_NextPart_000_0027_01CD9B7B.EA2D1C40--