Hi,
I am begeener to MySQL. I have installed Suse10 and MySQL and
mysql++ in my
pc.
i want to connect to MySQL through C. When I am compiling the program,
I am getting the following error.
########################################
#gcc -o custom1 -lmysqlclient -lz custom1.cpp
/usr/lib/gcc/i586-suse-linux/4.0.2/../../../../i586-suse-linux/bin/ld: cannot
find -lmysqlclient
collect2: ld returned 1 exit status
a-toraby:~/c/example # gcc -o custom1 -lmysqlclient -L
/usr/local/mysql/lib/mysql/ custom1.cpp
/tmp/ccPQEF5p.o: In function `main':
custom1.cpp:(.text+0x2f): undefined reference to
`mysqlpp::Connection::Connection(bool)'
custom1.cpp:(.text+0x46): undefined reference to `connect_to_db(int, char**,
mysqlpp::Connection&, char const*)'
custom1.cpp:(.text+0x7f): undefined reference to `mysqlpp::Connection::query()'
custom1.cpp:(.text+0x96): undefined reference to `std::basic_ostream<char,
std::char_traits<char> >& std::operator<< <std::char_traits<char>
>(std::basic_ostream<char, std::char_traits<char> >&, char const*)'...
...
...
...
...
...std::allocator<stock> > >(std::vector<stock, std::allocator<stock> >&,
mysqlpp::SQLQueryParms&, mysqlpp::query_reset)]+0x50): undefined reference to
`std::basic_string<char, std::char_traits<char>, std::allocator<char>
>::c_str() const'
custom1.cpp:(.gnu.linkonce.t._ZN7mysqlpp5Query7storeinISt6vectorI5stockSaIS3_EEEEvRT_RNS_13SQLQueryParmsENS_11query_resetE[void
mysqlpp::Query::storein<std::vector<stock, std::allocator<stock> >
>(std::vector<stock, std::allocator<stock> >&, mysqlpp::SQLQueryParms&,
mysqlpp::query_reset)]+0x71): undefined reference to `std::basic_string<char,
std::char_traits<char>, std::allocator<char> >::~basic_string()'
custom1.cpp:(.gnu.linkonce.t._ZN7mysqlpp5Query7storeinISt6vectorI5stockSaIS3_EEEEvRT_RNS_13SQLQueryParmsENS_11query_resetE[void
mysqlpp::Query::storein<std::vector<stock,
std::allocator<stock> > >(std::vector<stock, std::allocator<stock> >&,
mysqlpp::SQLQueryParms&, mysqlpp::query_reset)]+0x88): undefined reference to
`std::basic_string<char, std::char_traits<char>, std::allocator<char>
>::~basic_string()'
/tmp/ccPQEF5p.o:(.gnu.linkonce.r._ZTIN7mysqlpp8BadQueryE[typeinfo for
mysqlpp::BadQuery]+0x0): undefined reference to `vtable for
__cxxabiv1::__si_class_type_info'
/tmp/ccPQEF5p.o:(.eh_frame+0x12): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status
###################################################
my code is standard code in mysql++ examples directory
please help me.
---------------------------------
Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls. Great rates
starting at 1ยข/min.