0
私はVS 2013 Community Editionでプロジェクトを進めています。 MySQL Connector C++を使用します。MySQL Connector C++未解決の外部シンボル
Database.cpp:
#include "Database.h"
#include "Common.h"
#include <iostream>
//This function is used to connect to the MySQL database
void Database::Connect()
{
Config::loadConfig("config.ini");
MySQLSettings settings = Config::getMySQLSettings();
sql::Driver *driver;
sql::Connection *con;
sql::Statement *stmt;
sql::ResultSet *res;
//Creates a connection to your MySQL server
driver = get_driver_instance();
con = driver->connect("tcp://" + settings.host + ":3306", settings.username, settings.password);
//Connect to LUR database
con->setSchema(settings.database);
}
Database.h:ここではいくつかのコードです
#pragma once
#include "mysql_connection.h"
#include <cppconn/driver.h>
#include <cppconn/exception.h>
#include <cppconn/resultset.h>
#include <cppconn/statement.h>
class Database
{
public:
static void Connect(); //Database connection function
};
は、そのコードを使用すると、私はこれらのエラーを取得:
1>Database.obj : error LNK2001: unresolved external symbol __imp__get_driver_instance
1>Database.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall sql::SQLString::SQLString(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" ([email protected]@@[email protected][email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@@Z)
1>Database.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall sql::SQLString::~SQLString(void)" ([email protected]@@[email protected])
1>C:\Users\averysumner\Desktop\lurebornserver\Source\Release\LURServer.exe : fatal error LNK1120: 3 unresolved externals