我正在尝试在连接到 MySQL 服务器的 netbeans(和 win 7)上创建一个 C++ 程序。我正在使用从 MySQL 获得的库
#include <cppconn/driver.h>
#include <mysql_driver.h>
#include <mysql_connection.h>
int SQLConnection(){
sql::mysql::MySQL_Driver *driver;
sql::Connection *con;
driver = sql::mysql::get_mysql_driver_instance();
con = driver->connect("tcp://127.0.0.1:3306", "user", "password");
delete con;
}
但我不断收到这个错误。
"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory `/cygdrive/c/Users/Renier.SOFTWARESOL/Documents /NetBeansProjects/TestOne'
"/usr/bin/make" -f nbproject/Makefile-Debug.mk dist/Debug/Cygwin_4.x-Windows/testone.exe
make[2]: Entering directory `/cygdrive/c/Users/Renier.SOFTWARESOL/Documents/NetBeansProjects/TestOne'
mkdir -p build/Debug/Cygwin_4.x-Windows
rm -f build/Debug/Cygwin_4.x-Windows/MySQLConnect.o.d
g++ -c -g -I../../../../../MySQL/Connector\ C++\ 1.1.0/include -MMD -MP -MF build/Debug/Cygwin_4.x-Windows/MySQLConnect.o.d -o build/Debug/Cygwin_4.x-Windows/MySQLConnect.o MySQLConnect.cpp
mkdir -p dist/Debug/Cygwin_4.x-Windows
g++ -o dist/Debug/Cygwin_4.x-Windows/testone build/Debug/Cygwin_4.x-Windows/ISP.o build/Debug/Cygwin_4.x-Windows/WorkDone.o build/Debug/Cygwin_4.x-Windows/Individual.o build/Debug/Cygwin_4.x-Windows/Domain.o build/Debug/Cygwin_4.x-Windows/main.o build/Debug/Cygwin_4.x-Windows/Employee.o build/Debug/Cygwin_4.x-Windows/Device.o build/Debug/Cygwin_4.x-Windows/Computer.o build/Debug/Cygwin_4.x-Windows/ThreeG.o build/Debug/Cygwin_4.x-Windows/Line.o build/Debug/Cygwin_4.x-Windows/Software.o build/Debug/Cygwin_4.x-Windows/MySQLConnect.o build/Debug/Cygwin_4.x-Windows/Site.o build/Debug/Cygwin_4.x-Windows/LogMethod.o build/Debug/Cygwin_4.x-Windows/Request.o build/Debug/Cygwin_4.x-Windows/Network.o build/Debug/Cygwin_4.x-Windows/Email.o build/Debug/Cygwin_4.x-Windows/runner.o build/Debug/Cygwin_4.x-Windows/MAC.o build/Debug/Cygwin_4.x-Windows/Router.o build/Debug/Cygwin_4.x-Windows/Company.o build/Debug/Cygwin_4.x-Windows/Status.o build/Debug/Cygwin_4.x-Windows/ThreeGModem.o -L../../../../../MySQL/Connector\ C++\ 1.1.0/lib -L../../../../../MySQL/MySQL\ Server\ 5.5/lib -lmysql -lmysqlcppconn-static
nbproject/Makefile-Debug.mk:83: recipe for target `dist/Debug/Cygwin_4.x-Windows/testone.exe' failed
make[2]: Leaving directory `/cygdrive/c/Users/Renier.SOFTWARESOL/Documents/NetBeansProjects/TestOne'
nbproject/Makefile-Debug.mk:80: recipe for target `.build-conf' failed
make[1]: Leaving directory `/cygdrive/c/Users/Renier.SOFTWARESOL/Documents/NetBeansProjects/TestOne'
nbproject/Makefile-impl.mk:39: recipe for target `.build-impl' failed
build/Debug/Cygwin_4.x-Windows/MySQLConnect.o: In function `get_mysql_driver_instance':
/cygdrive/c/Users/Renier.SOFTWARESOL/Documents/NetBeansProjects/TestOne/../../../../../MySQL/Connector C++ 1.1.0/include/mysql_driver.h:87: undefined reference to `sql::mysql::get_driver_instance()'
collect2: ld returned 1 exit status
make[2]: *** [dist/Debug/Cygwin_4.x-Windows/testone.exe] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
BUILD FAILED (exit value 2, total time: 12s)
有什么建议吗?