Mysql Connector Doesn't Work (VS2008 C++)

Started by
0 comments, last by Forsith 14 years ago
Hello I'm getting this linking error on this line using mysql's connector C++ API.

//Initalize mysql connector C++
		driver = sql::mysql::get_mysql_driver_instance();

Error: LNK2001: unresolved external symbol "__declspec(dllimport) class sql::mysql::MySQL_Driver * __cdecl sql::mysql::get_mysql_driver_instance(void)" (__imp_?get_mysql_driver_instance@mysql@sql@@YAPAVMySQL_Driver@12@XZ) How my headers are

//...
#include <tchar.h>
#include <string.h>
#include <vector>
#include <stdexcept>


/* MySQL Connector/C++ specific headers */
#include <mysql_connection.h>
#include <mysql_driver.h>

#include <cppconn/driver.h>
#include <cppconn/connection.h>
#include <cppconn/statement.h>
#include <cppconn/prepared_statement.h>
#include <cppconn/resultset.h>
#include <cppconn/metadata.h>
#include <cppconn/resultset_metadata.h>
#include <cppconn/exception.h>
#include <cppconn/warning.h>




And yes I have "mysqlcppconn.lib" added and my project is in release mode. I'm I forgetting something to do with the API? I downloaded the API from the installer from Mysql directly if that helps a little. Thanks, Andrew
Check out my open source code projects/libraries! My Homepage You may learn something.
Advertisement
Hello,

I recently had the same problem. I use an 64bits OS, and I used the 64bits version of MySQL Server in combination with the 32 bits connector.

The solution for me was to download the archived version of both the connector and the community server, unzip them somewhere, let MSVS2008 know where they were and it instantly worked.

Edit: I forgot to mention that you also need to include the "libmysql.lib" and "mysqlclient.lib" from the server edition.

Maybe that will fix your problem?

Regards,

Forsith

This topic is closed to new replies.

Advertisement