Reputation: 2894
I am new to Visual C++. I wanted to work with MySQL/C++. So, I
C:\Program Files\MySQL\Connector.C++ 1.1\include <-- Headers
C:\Program Files\MySQL\Connector.C++ 1.1\lib <-- Libs
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 : 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 : 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 : error LNK2019: unresolved external symbol __imp__get_driver_instance referenced in function _wmain
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)
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
I have referred below so far, but no help
Upvotes: 1
Views: 2608
Reputation: 2894
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 ! :)
Upvotes: 5