开发者

Problem in connection mysql with c++

开发者 https://www.devze.com 2023-02-22 06:06 出处:网络
Whenever i try building the c++ program with mysql connectivity.. i get the following error g++ -o dist/Debug/GNU-Linux-x86/mysqltest build/Debug/GNU-Linux-x86/main.o

Whenever i try building the c++ program with mysql connectivity.. i get the following error

g++ -o dist/Debug/GNU-Linux-x86/mysqltest build/Debug/GNU-Linux-x86/main.o
    -L/usr/local/lib/lib -L/usr/lib -lmysqlclient_r -lmysqlcppconn
    /usr/lib/libmysqlcppconn-static.a 
/usr/local/lib/lib/libmysqlcppconn.so: undefined reference to
    `vtable for std::basic_开发者_StackOverflow中文版streambuf<char, std::char_traits<char> >@GLIBCPP_3.2'
/usr/local/lib/lib/libmysqlcppconn.so: undefined reference to
    `std::basic_ios<char, std::char_traits<char> >::~basic_ios()@GLIBCPP_3.2'
/usr/local/lib/lib/libmysqlcppconn.so: undefined reference to
    `std::ios_base::ios_base()@GLIBCPP_3.2'
/usr/local/lib/lib/libmysqlcppconn.so: undefined reference to
    `std::basic_ios<char, std::char_traits<char> >::init(std::basic_streambuf<char, std::char_traits<char> >*)@GLIBCPP_3.2'
make[2]: Leaving directory `/home/prasanth/NetBeansProjects/mysqltest'
/usr/local/lib/lib/libmysqlcppconn.so: undefined reference to
    `std::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >::str() const@GLIBCPP_3.2'
make[1]: Leaving directory `/home/prasanth/NetBeansProjects/mysqltest'
/usr/local/lib/lib/libmysqlcppconn.so: undefined reference to
    `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::compare(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const@GLIBCPP_3.2'
/usr/local/lib/lib/libmysqlcppconn.so: undefined reference to
    `vtable for std::bad_alloc@GLIBCPP_3.2'

After extensive search i found that there is some problem between libstdc++6 and g++ 4.4.5 compiler

Can anyone please tell how to solve this issue


Seems like GLIBCPP_3.2 refers to libstdc++5, and not libstdc++6.

Obviously the MySQL lib is compiled with an earlier version of the compiler. Perhaps you can find an updated version?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号