Jump to content
  • Advertisement
Sign in to follow this  

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

This topic is 3034 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post

Link to post
Share on other sites

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?



Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!