我一直在尝试让MySQL使用Visual Studio 2012和Windows(x86) . 我在Linux上没有问题,但是我在Windows上遇到了很多错误 . 这是我的代码(我从一些网站复制过来测试它是否真的不起作用)

#include <stdafx.h>
#include <iostream>
#include <cstdlib>
#include <string>
#include "mysql_connection.h"
#include "mysql_driver.h"
#include <cppconn/exception.h>
#include <cppconn/resultset.h>
#include <cppconn/statement.h>
#include <cppconn/prepared_statement.h>

using namespace std;

const string server   = "tcp://somemysqlserver.com";
const string username = "someusers";
const string password = "somepass";

int main()
{
    sql::Driver     *driver;
    sql::Connection *dbConn; 
    sql::Statement  *stmt;  
    sql::ResultSet  *res; 

    try
    {
        driver = get_driver_instance();
    }
    catch (sql::SQLException e)
    {
        cout << "Could not get a database driver. Error message: " << e.what() << endl;
        system("pause");
        exit(1);
    }


    try
    {
        dbConn = driver->connect(server, username, password);
    }
    catch (sql::SQLException e)
    {
        cout << "Could not connect to database. Error message: " << e.what() << endl;
        system("pause");
        exit(1);
    }

    stmt = dbConn->createStatement(); 

    try
    {
        stmt->execute("USE mysql");   

        res = stmt->executeQuery("show tables"); 
    }
    catch (sql::SQLException e)
    {
        cout << "SQL error. Error message: " << e.what() << endl;
        system("pause");
        exit(1);
    }


    while (res->next())
    {
        cout << res->getString(1) << endl;                
    }

    delete res;
    delete stmt;
    delete dbConn;

    system("pause");
    return 0;
}

问题首先是config.h中的一些错误(第60行,似乎是一个流行的错误) . 我试过this,没有用,但问题以某种方式修复了 . 现在我收到以下错误:

ConsoleApplication1.obj:错误LNK2019:函数__catch $ main中引用的未解析的外部符号“declspec(dllimport)public: thiscall sql :: SQLString :: ~SQLString(void)”(_ imp _ ?? 1SQLString @sql @@ QAE @ XZ) $ 0 1> ConsoleApplication1.obj:错误LNK2019:未解析的外部符号“declspec(dllimport)public: thishisall sql :: SQLString :: SQLString(class std :: basic_string,class std :: allocator> const&)”(__ imp _ ?? 0SQLString @sql @@ QAE @ ABV?$ basic_string @ DU?$ char_traits @ D @ std @@ V?$ allocator @ D @ 2 @@ std @@@ Z)函数__catch $ main $ 0 1> ConsoleApplication1.obj:错误LNK2019:函数__catch $ main $ 2中引用了未解析的外部符号“declspec(dllimport)public: thiscall sql :: SQLString :: SQLString(char const * const)”( imp _ ?? 0SQLString @sql @@ QAE @ QBD @ Z) 1> ConsoleApplication1.obj:错误LNK2019:未解析的外部符号>“__ declspec(dllimport)public:class std :: basic_string,class std :: allocator> const&thiscall sql :: SQLString :: asStdString(void)const”( im p_?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)1> ConsoleApplication1.obj:错误LNK2019:函数_main 1中引用的未解析的外部符号__imp__get_driver_instance> ConsoleApplication1.obj:错误LNK2019:未解析的外部符号“__declspec(dllimport)public:virtual thiscall sql :: SQLException :: ~SQLException(void)“( imp _ ?? 1SQLException @sql @@ UAE @ XZ)在函数__catch $ _main $ 0中引用

我真的不知道如何解决这个问题,我已经尝试了几乎所有内容,如更改库或阅读内容,文档等等,没有任何帮助 . 任何帮助将不胜感激 .