gpt4 book ai didi

c++ - c++连接mysql的问题

转载 作者:太空宇宙 更新时间:2023-11-04 14:23:57 24 4
gpt4 key购买 nike

每当我尝试使用 mysql 连接构建 c++ 程序时.. 我收到以下错误

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_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'

经过广泛搜索,我发现 libstdc++6 和 g++ 4.4.5 编译器之间存在一些问题

谁能告诉我如何解决这个问题

最佳答案

似乎 GLIBCPP_3.2 指的是 libstdc++5,而不是 libstdc++6。

显然,MySQL 库是使用较早版本的编译器编译的。也许您可以找到更新版本?

关于c++ - c++连接mysql的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5547203/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com