title: C++ MySQL Linker errors
body: <p>I am new to Visual C++. I wanted to work with MySQL/C++. 
  So, I</p>
  
  <ul>
  <li>Installed MySQL on my machine Installed VS 2010 Professional on my
  machine</li>
  <li>From the internet, I found that My SQL drivers are found in </li>
  </ul>
  
  <blockquote>
    <p>C:\Program Files\MySQL\Connector.C++ 1.1\include  &lt;-- Headers</p>
    
    <p>C:\Program Files\MySQL\Connector.C++ 1.1\lib      &lt;-- Libs</p>
  </blockquote>
  
  <ul>
  <li>I made a sample program, which I copied from <a href="https://stackoverflow.com/questions/16424828/how-to-connect-mysql-database-using-c">this</a>.</li>
  <li>Build the project</li>
  <li>Got errors related to boost </li>
  <li>Downloaded Boost from <a href="https://sourceforge.net/projects/boost/files/boost-binaries/" rel="nofollow noreferrer">Download boost_1_61_0.7z (74.8 MB)</a></li>
  <li>Unzipped the archive</li>
  <li>Added Include path using <strong>Project Properties > C/C++ > General > Additional Include Directories</strong></li>
  </ul>
  
  <p><a href="https://i.stack.imgur.com/6oo52.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6oo52.png" alt="enter image description here"></a></p>
  
  <ul>
  <li>Added Linker additional libraries using <strong>Project Properties > Linker > General > Additional Library Directories</strong></li>
  </ul>
  
  <p><a href="https://i.stack.imgur.com/xELmC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xELmC.png" alt="enter image description here"></a></p>
  
  <ul>
  <li>Built the Project</li>
  <li>Now it fails with below errors</li>
  </ul>
  
  <blockquote>
    <p>1>DemoDB.obj : error LNK2019: unresolved external symbol
    "__declspec(dllimport) public: class std::basic_string,class std::allocator > const &amp; __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 </p>
    
    <p>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 </p>
    
    <p>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</p>
    
    <p>1>DemoDB.obj : error LNK2019: unresolved external symbol
    __imp__get_driver_instance referenced in function _wmain </p>
    
    <p>1>DemoDB.obj : error LNK2019: unresolved external symbol "__declspec(dllimport)
    public: class std::basic_string,class std::allocator > const &amp; __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 > &amp; __cdecl std::operator&lt;&lt;(class
    std::basic_ostream > &amp;,class
    sql::SQLString const &amp;)"
    (??6std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@ABVSQLString@sql@@@Z)</p>
  </blockquote>
  
  <p><a href="https://i.stack.imgur.com/6Drnm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6Drnm.png" alt="enter image description here"></a></p>
  
  <p><strong>Please help. I am totally stuck</strong></p>
  
  <p><strong>Edit:</strong></p>
  
  <p>This line is causing below error</p>
  
  <pre><code>cout &lt;&lt; ", SQLState: " &lt;&lt; e.getSQLState() &lt;&lt; " )" &lt;&lt; endl;
  </code></pre>
  
  <blockquote>
    <p>1>DemoDB.obj : error LNK2019: unresolved external symbol
    "__declspec(dllimport) public: class std::basic_string,class std::allocator > const &amp; __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</p>
  </blockquote>
  
  <p>I have referred below so far, but no help</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/20537637/c-mysql-linker-error">C++ MySQL Linker Error</a></li>
  <li><a href="https://stackoverflow.com/questions/18470721/c-mysql-connector-linker-errors--">C++ mySQL connector LINKER errors (Windows)</a> windows</li>
  <li><a href="https://stackoverflow.com/questions/4445418/how-to-add-additional-libraries-in-c">How do I add additional libraries in C++?</a></li>
  <li><a href="https://stackoverflow.com/questions/20168138/mysql-c-connector-unresolved-external-symbol-get-driver-instance">MySQL C++ Connector unresolved external symbol _get_driver_instance</a></li>
  </ul>