Quantcast
Channel: MySQL Forums - Connector/C++
Viewing all articles
Browse latest Browse all 527

Connector linking problem (2 replies)

$
0
0
I'm having a linking problem with MySQL Connector/C++.
I have included these files:

#include "mysql_connection.h"

#include <cppconn/driver.h>
#include <cppconn/exception.h>
#include <cppconn/resultset.h>
#include <cppconn/statement.h>

and I cannot get these simple lines to work:

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

Now I have gone into the project properties and added the additional include directory for "C:\Program Files\MySQL\MySQL Connector C++ 1.0.5\include" (that is where it is installed on my computer) and added the additional library directories of "C:\Program Files\MySQL\MySQL Connector C++ 1.0.5\lib\opt" and "C:\xampp\mysql\lib\opt" (Using xampp) and I have added the additional dependencies of mysqlcppconn.lib and libmysql.lib. However when to try to build the project I am getting an error:

"error LNK2019: unresolved external symbol __imp__get_driver_instance referenced"...

Looking around on various forums everyone says this is a linking problem. I have tried using the mysqlcppconn-static.lib and that did nothing at all. If I remove both dependencies mysqlcppconn.lib and libmysql.lib so that I have no additional dependencies for the project I still get the same error, so it is as though it is just ignoring the dependencies I'm providing.

I have also tried including:

#include "mysql_driver.h"

and then using:

sql::mysql::MySQL_Driver *driver;
driver = sql::mysql::get_mysql_driver_instance();

however I still get the same error when trying to build.

Anyone have any idea what I'm doing wrong?

Viewing all articles
Browse latest Browse all 527

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>