我的cpp程序在终端上运行良好并且也输出了输出。它运行时使用:
g++ cipher.cpp -lmysqlcppconn
但是当我在eclipse中尝试相同时它显示以下错误?
12:07:07 **** Incremental Build of configuration Debug for project cipher ****
make all
Building file: ../src/cipher.cpp
Invoking: GCC C++ Compiler
g++ -I../usr/include/cppconn -I../usr/include -I/usr/include /boost -O0 -g3 -Wall -c -fmessage-length=0 -lmysqlcppconn -lmysqlclient -MMD -MP -MF"src/cipher.d" -MT"src/cipher.d" -o "src/cipher.o" "../src/cipher.cpp"
/root/Downloads/cipher/Debug/../src/cipher.cpp:528: undefined reference to `sql::mysql::get_driver_instance()'
collect2: ld returned 1 exit status
make: *** [cipher] Error 1
11:54:39 Build Finished (took 472ms)
程序标题部分包括
#include <cppconn/driver.h>
#include <cppconn/exception.h>
#include <cppconn/resultset.h>
#include <cppconn/statement.h>
#include "mysql_driver.h"
#include "mysql_connection.h"
使用命名空间sql :: mysql;
选项-lmysqlcppconn和-lmysqlclient包含在project-&gt; properties-&gt; c / c ++ Build-&gt; Settings-&gt; miscalleneous-&gt;其他标志
Eclipse IDE版本:Luna Service Release 2(4.4.2)
在eclipse“path and symbols”中指定所有“includes”和“libraries”是什么?
我已经完成了类似查询的答案,但他们没有帮助我。
我正在研究centos6.6