VC++;2010 MySQL有一些错误 我有Visual Studio 10 C++、MySQL连接器和服务器。

VC++;2010 MySQL有一些错误 我有Visual Studio 10 C++、MySQL连接器和服务器。,c++,mysql,C++,Mysql,我的代码是: #include "mysql_connection.h" #include "mysql_driver.h" #include <cppconn/driver.h> #include <cppconn/exception.h> #include <cppconn/resultset.h> #include <cppconn/statement.h> #include <cppconn/prepared_state

我的代码是:

 #include "mysql_connection.h"
 #include "mysql_driver.h"
 #include <cppconn/driver.h>
 #include <cppconn/exception.h>
 #include <cppconn/resultset.h>
 #include <cppconn/statement.h>
 #include <cppconn/prepared_statement.h>
 void main()
    {
      sql::Driver *driver;
      sql::Connection *con;
      sql::Statement *stmt;
      sql::ResultSet *res;
      sql::PreparedStatement *pstmt;
      con = driver->connect("localhost","root","admin12");
    }

帮助?

其他使用MySQL连接器的人似乎编写了这样的代码

sql::Driver *driver; 
driver = get_driver_instance(); 

然后,
驱动程序
变量不再是未初始化的。

您是否阅读了错误消息?“变量没有初始化就使用了。”听起来很明显,在使用之前,你没有把这个变量设置成任何有意义的值。我怎么做?我在C++中坏了。看来你需要先阅读一个关于C++的教程,然后再尝试连接到数据库。我从来没有想过在这里说。但是请去学习C++。您似乎不知道shitGive我的错误:错误1错误LNK2001:símbolo externo\u imp\u get\u driver\u实例在解析器A:\LoginServer\LoginServer\main.obj LoginServer错误2错误LNK2001:símbolo externo“\u declspec(dllimport)public:virtual\u thiscall sql::SQLException:::~SQLException(void)”(\u imp)??1SQLException@sql@@UAE@XZ)sin解析程序A:\LoginServer\LoginServer\main.obj LoginServer
sql::Driver *driver; 
driver = get_driver_instance();