gpt4 book ai didi

c++ - Netbeans C++ 与 mysql windows

转载 作者:行者123 更新时间:2023-11-30 01:36:22 26 4
gpt4 key购买 nike

我正在使用 netbeans 7 (c++) 使用 Boost 库 (boost_1_53_0) 和所需的 mySql C++ 库(include 和 Lib)连接到 mySQL我在项目属性->C++编译器->包含目录中添加了库的路径。

我还在项目属性->链接器->包含目录中添加了库的路径。最后我将 mysqlcppconn.dll 添加到项目属性->链接器->库

这是程序:我只是在测试

#include <cstdlib>

using namespace std;

#include "cppconn/driver.h"
#include "cppconn/connection.h"
/*
*/
int main(int argc, char** argv) {


sql::Driver *driver ;
sql ::Connection *conn;

driver = get_driver_instance();
conn = driver->connect("localhost","root","1qaz");
return 0;
}

我在输出中遇到此错误:/cygdrive/c/Users/NetBeansProjects/CppApplication_3/dist/Debug/Cygwin-Windows/cppapplication_3.exe:加载共享库时出错:mysqlcppconn.dll:无法打开共享对象文件:没有这样的文件或目录

我尝试了一些关于包含库的建议解决方案,但仍然没有任何效果任何建议

最佳答案

您应该将 mysqlcppconn.dll 放入可执行文件的目录中。也许它需要一些其他的 DLL。

这与编译器设置无关(看起来你的程序编译正常)。程序在启动时就是找不到DLL。

关于c++ - Netbeans C++ 与 mysql windows,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16823573/

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