List:MySQL++« Previous MessageNext Message »
From:lee Date:January 11 2010 10:05am
Subject:Why cant I define more than two sql_create_# macro?
View as plain text  
Hi 
    Here is the problems:
    I want to define two ssql in one .h file, like this:
 #ifndef MYCC_H
#define MYCC_H
#define MYSQLPP_SSQLS_NO_STATICS
#include <mysql++/mysql++.h>
#include <mysql++/ssqls.h>

sql_create_2(table1,
             1,2,
                         mysqlpp::sql_text,    s1,
                         mysqlpp::sql_text,    s2);

sql_create_5(document,
             1,5,
                         mysqlpp::sql_int,     id,
                         mysqlpp::sql_varchar, usr,
                         mysqlpp::sql_text,    text,
                        mysqlpp::sql_varchar, s1,
                         mysqlpp::sql_varchar, s2);
....
//than here is another source...
 
but  when I complier this file, it give me some link error like this:
//////////////////////////////////////////////////////////////////////////////////////
mycc.o: In function `table1::table() const':
/usr/include/c++/4.2/bits/ios_base.h:629: undefined reference to `table1::table_'
mycc.o: In function `std::basic_ostream<char, std::char_traits<char> >&
operator<< <mysqlpp::do_nothing_type0>(std::basic_ostream<char,
std::char_traits<char> >&,
table1_field_list<mysqlpp::do_nothing_type0> const&)':
/test/mycc.h:11: undefined reference to `table1::names'
/test/mycc.h:11: undefined reference to `table1::names'
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
I have alread define the MYSQLPP_SSQLS_NO_STATICS macro, but it still link error. 
BUT....if only call sql_create_5(table2......)   it won't cause this  problem,  and it
works right.(means I don't define table1)
 
so, I request some help, thanks very much....
Thread
Why cant I define more than two sql_create_# macro?lee11 Jan
  • Re: Why cant I define more than two sql_create_# macro?Warren Young11 Jan