4

我们已经开始将我们的应用程序与-libmysqlcppconn-staticMySQL支持链接起来。

当我们为调试而编译时,一切正常,但是当我们为发布而编译时,gcc -O2我们得到了错误。

我们已经追踪到有问题的编译器选项是-funit-at-a-time. 我们可能会收到以下形式的错误:

libmysqlcppconn-static.a(mysql_connection.cpp.o): 在函数 sql::mysql::MySQL_Savepoint::getSavepointId()': mysql_connection.cpp:(.text+0x8d): undefined reference to std::allocator::allocator()' mysql_connection.cpp:(.text+0x133): 未定义引用`std::allocator ::~allocator() '

我们目前正在通过包括-fno-unit-at-a-time. 任何有关我们如何纠正此问题的见解将不胜感激

4

1 回答 1

0

这可能是因为您正在使用 gcc 编译代码.. 尝试使用 g++ 编译文件,否则尝试使用以下命令 gcc -lstdc++ file.cpp

于 2013-06-11T18:01:26.400 回答