我按照这个:http://docs.oracle.com/cd/E17952_01/connector-cpp-en/connector-cpp-apps-windows-visual-studio.html来安装MySQL并使用动态链接进行配置。
我的程序编译但是当我调试它并且它到达它执行sql->连接时,它会因一些访问冲突而崩溃。
我也明白了:
+ driver 0x014b3a00 <Information not available, no symbols loaded for mysqlcppconn.dll> sql::mysql::MySQL_Driver *
Database.cpp
#include "Functions.h"
#include "Settings.h"
#include "Database.h"
#define mysqlcppconn_EXPORTS
/* MySQL Connector/C++ specific headers */
#include <mysql_driver.h>
#include <mysql_connection.h>
#include <cppconn/statement.h>
#include <cppconn/prepared_statement.h>
#include <cppconn/resultset.h>
#include <cppconn/metadata.h>
#include <cppconn/resultset_metadata.h>
#include <cppconn/exception.h>
#include <warning.h>
using namespace std;
using namespace sql;
CDatabase::CDatabase(CSettings* settings)
{
Connection *con;
sql::mysql::MySQL_Driver *driver;
driver = sql::mysql::get_mysql_driver_instance();
con = driver->connect("", "", "");
con->setSchema("");
cout << "Connected.";
}
CDatabase::~CDatabase()
{
}
我尝试了什么?
我的路径:
C:\Program Files (x86)\MySQL\MySQL Connector C++ 1.1.3\lib\opt
C:\Program Files (x86)\MySQL\MySQL Connector C++ 1.1.3\include
输出目录中的DLL:
libmysql.dll
mysqlcppconn.dll
答案 0 :(得分:0)
是的,我的不好是它给出了一个sql错误。 没有意识到我必须尝试......抓住它哈哈!