我尝试将Netbeans (7.3, Windows 7)中的mysql-connector 1.1.3与Mingw-Compiler链接到我的c++项目。在项目属性中,我在"包含的目录"one_answers"附加的链接器目录"下添加了所有mysql连接器目录(包括,lib, cppcon)。我添加了boost库。但是在编译器输出中说always:
mysql_connection.h: No such file or directory对不起,我的英语不好,谢谢你的帮助…
完整输出:
"/usr/bin/make" -f nbproject/Makefile-Debug。mkqmake = SUBPROJECTS= .build-confmake[1]:输入目录
/cygdrive/c/Users/Toni/Desktop/dev/Wiesel/new/tests/sql_test2' "/usr/bin/make" -f nbproject/Makefile-Debug.mk dist/Debug/MinGW-Windows/sql_test2.exe make[2]: Entering directory
/cygdrive/c/Users/Toni/Desktop/dev/Wiesel/new/tests/sql_test2'mkdir -p build/Debug/MinGW-Windowsrm -f build/Debug/MinGW-Windows/main.o.dg++ -c -g -I/D/libs/mysql-connector-c++-noinstall-1.1.3-win32/include -I/D/libs/mysql-connector-c++-noinstall-1.1.3-win32/include/cppconn -I/D/libs/mysql-connector-c++-noinstall-1.1.3-win32/lib -I/D/libs/boost_1_53_0 - D/libs/boost_1_53_0/boost -I/D/libs/boost_1_53_0/libs -MMD -MP -MF build/Debug/MinGW-Windows/main.o。d -o build/Debug/MinGW-Windows/maino main.cppmain.cpp:9:30:致命错误:mysql_connection.h:没有这样的文件或目录编译终止。nbproject/Makefile-Debug。mk:66: recipe for targetbuild/Debug/MinGW-Windows/main.o' failed make[2]: [build/Debug/MinGW-Windows/main.o] Error 1 (ignored) mkdir -p dist/Debug/MinGW-Windows g++ -o dist/Debug/MinGW-Windows/sql_test2 build/Debug/MinGW-Windows/main.o -L/D/libs/boost_1_53_0/boost -L/D/libs/boost_1_53_0/libs -L/D/libs/mysql-connector-c++-noinstall-1.1.3-win32 -L/D/libs/mysql-connector-c++-noinstall-1.1.3-win32/include -L/D/libs/mysql-connector-c++-noinstall-1.1.3-win32/include/cppconn -L/D/libs/mysql-connector-c++-noinstall-1.1.3-win32/lib -lmysqlcppconn -lmysqlcppconn-static -lmysqlcppconn -static g++.exe: error: build/Debug/MinGW-Windows/main.o: No such file or directory nbproject/Makefile-Debug.mk:62: recipe for target
dist/Debug/MinGW-Windows/sql_test2.exe'失败make[2]: [dist/Debug/MinGW-Windows/sql_test2.exe] Error 1(忽略)make[2]: left directory/cygdrive/c/Users/Toni/Desktop/dev/Wiesel/new/tests/sql_test2' make[1]: Leaving directory
/cygdrive/c/Users/Toni/Desktop/dev/Wiesel/new/tests/sql_test2'
这应该是你要找的:
库通常位于其自己的安装目录中,因此您需要将NB指向它所在的位置。如果你在"项目"窗口中右键单击项目名称,你会看到一个属性选项。
- 选择Build/c++编译器选项来添加。h文件的目录。
- 选择Build/Linker来添加dll文件的目录。
在Netbeans 7.0中包含c++库