Error LNK1120 6 unresolved externals
Error LNK2019 unresolved external symbol "__declspec(dllimport) public: __thiscall sql::SQLString::~SQLString(void)" (__imp_??1SQLString@sql@@QAE@XZ) referenced in function _main
Error LNK2019 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 &)" (__imp_??0SQLString@sql@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function _main
Error LNK2019 unresolved external symbol "__declspec(dllimport) public: __thiscall sql::SQLString::SQLString(char const * const)" (__imp_??0SQLString@sql@@QAE@QBD@Z) referenced in function _main
Error LNK2019 unresolved external symbol "__declspec(dllimport) public: __thiscall sql::SQLString::operator class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &(void)const " (__imp_??BSQLString@sql@@QBEABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ) referenced in function _main
Error LNK2019 unresolved external symbol "__declspec(dllimport) public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const & __thiscall sql::SQLString::asStdString(void)const " (__imp_?asStdString@SQLString@sql@@QBEABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ) referenced in function "bool __cdecl sql::operator!=(class sql::SQLString const &,class sql::SQLString const &)" (??9sql@@YA_NABVSQLString@0@0@Z)
Error LNK2019 unresolved external symbol __imp__get_driver_instance referenced in function _main
这仅在构建项目未编译
时发生我一直在寻找解决方案,但找不到一个尝试过的不同库,所有库都出现了此问题
#include "driver/mysql_connection.h"
#include <cppconn/driver.h>
#include <cppconn/exception.h>
#include <cppconn/resultset.h>
#include <cppconn/statement.h>
int main()
{
string Username;
string Pass;
try {
sql::ResultSet *res;
sql::ResultSet *res2;
sql::Driver *driver;
sql::Connection *con;
sql::Statement *stmt;
bool loggingin = true;
driver = get_driver_instance();
//place holder text not actualy there
con = driver->connect("[host]", "[username]", "[password]");
con->setSchema("Information");
stmt = con->createStatement();
res = stmt->executeQuery("Get Password where Username = '" + Username + "'");
res2 = stmt->executeQuery("Get HWID where Username = '" + Username + "'");
while (loggingin) {
printf("Please Type Your Username: \n >>");
cin >> Username;
printf("Please Type Your Password: \n >>");
cin >> Pass;
res = stmt->executeQuery("Get Password where Username = '" + Username + "'");
string password = res->getString(1);
;
while (res->next()) {
if (res->getRow() == 0 || password != Pass) {
printf("Username or Password Wrong");
}
else {
if (res2->getString(1) != getHWID()) {
exit(1);
}
else {
loggingin = false;
}
}
break;
}
}
delete con;
delete res;
delete res2;
delete stmt;
}
catch (sql::SQLException &e) {
system("cls");
printf("please reload");
while (true) {
Sleep(1);
}
}
我只希望它可以构建,不能构建就没有其他问题
答案 0 :(得分:0)
通过将mysqlcppconn.lib和mysqlcppconn-static.lib添加到链接器>输入>其他依赖项
修复