[英]C++ MySQL Linker errors
I am new to Visual C++. 我是Visual C ++的新手。 I wanted to work with MySQL/C++.
我想使用MySQL / C ++。 So, I
所以我
C:\\Program Files\\MySQL\\Connector.C++ 1.1\\include <-- Headers
C:\\ Program Files \\ MySQL \\ Connector.C ++ 1.1 \\ include <-标头
C:\\Program Files\\MySQL\\Connector.C++ 1.1\\lib <-- Libs
C:\\ Program Files \\ MySQL \\ Connector.C ++ 1.1 \\ lib <-库
1>DemoDB.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class std::basic_string,class std::allocator > const & __thiscall sql::SQLException::getSQLState(void)const " (__imp_?getSQLState@SQLException@sql@@QBEABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ) referenced in function __catch$_wmain$0
1> DemoDB.obj:错误LNK2019:无法解析的外部符号“ __declspec(dllimport)public:class std :: basic_string,class std :: allocator> const&__thiscall sql :: SQLException :: getSQLState(void)const”((__imp_?getSQLState函数__catch $ _wmain $ 0中引用的@ SQLException @ sql @@ QBEABV?$ basic_string @ DU?$ char_traits @ D @ std @@ V?$ allocator @ D @ 2 @@ std @@ XZ)
1>DemoDB.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: int __thiscall sql::SQLException::getErrorCode(void)const " (__imp_?getErrorCode@SQLException@sql@@QBEHXZ) referenced in function __catch$_wmain$0 1>DemoDB.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sql::SQLString::~SQLString(void)" (__imp_??1SQLString@sql@@QAE@XZ) referenced in function _wmain
1> DemoDB.obj:错误LNK2019:未解析的外部符号“ __declspec(dllimport)公共:int __thiscall sql :: SQLException :: getErrorCode(void)const”(__imp_?getErrorCode @ SQLException @ sql @@ QBEHXZ)在函数__catch $中引用_wmain $ 0 1> DemoDB.obj:错误LNK2019:无法解析的外部符号“ __declspec(dllimport)public:__thiscall sql :: SQLString ::〜SQLString(void)”(__imp _ ?? 1SQLString @ sql @@ QAE @ XZ) _wmain
1>DemoDB.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sql::SQLString::SQLString(char const * const)" (__imp_??0SQLString@sql@@QAE@QBD@Z) referenced in function _wmain
1> DemoDB.obj:错误LNK2019:未解析的外部符号“ __declspec(dllimport)公共:__thiscall sql :: SQLString :: SQLString(char const * const)”(__imp _ ?? 0SQLString @ sql @@ QAE @ QBD @ Z)在函数_wmain中
1>DemoDB.obj : error LNK2019: unresolved external symbol __imp__get_driver_instance referenced in function _wmain
1> DemoDB.obj:错误LNK2019:函数_wmain中引用的未解析的外部符号__imp__get_driver_instance
1>DemoDB.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class std::basic_string,class std::allocator > 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 "class std::basic_ostream > & __cdecl std::operator<<(class std::basic_ostream > &,class sql::SQLString const &)" (??6std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@ABVSQLString@sql@@@Z)
1> DemoDB.obj:错误LNK2019:无法解析的外部符号“ __declspec(dllimport)public:class std :: basic_string,class std :: allocator> 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)在函数“ class std :: basic_ostream>&__cdecl std中引用: :operator <<((class std :: basic_ostream>&,class sql :: SQLString const&)“(?? 6std @@ YAAAV?$ basic_ostream @ DU?$ char_traits @ D @ std @@@@ 0 @ AAV10 @ ABVSQLString @ sql @@@ Z)
Please help. 请帮忙。 I am totally stuck
我完全被困住了
Edit: 编辑:
This line is causing below error 该行导致以下错误
cout << ", SQLState: " << e.getSQLState() << " )" << endl;
1>DemoDB.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class std::basic_string,class std::allocator > const & __thiscall sql::SQLException::getSQLState(void)const " (__imp_?getSQLState@SQLException@sql@@QBEABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@XZ) referenced in function __catch$_wmain$0
1> DemoDB.obj:错误LNK2019:无法解析的外部符号“ __declspec(dllimport)public:class std :: basic_string,class std :: allocator> const&__thiscall sql :: SQLException :: getSQLState(void)const”((__imp_?getSQLState函数__catch $ _wmain $ 0中引用的@ SQLException @ sql @@ QBEABV?$ basic_string @ DU?$ char_traits @ D @ std @@ V?$ allocator @ D @ 2 @@ std @@ XZ)
I have referred below so far, but no help 到目前为止,我已经在下面提到了,但没有帮助
I managed to solve this, after a lot of struggle.
经过很多努力,我设法解决了这个问题。 Below is what helped me
以下是对我有帮助的
After all this, built the project and it ran fine ! 毕竟,构建了项目并运行良好! :)
:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.