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

undefined reference to `get_driver_instance' (1 reply)

$
0
0
Hi, I have compile failure for c++ embedded mysql. The program is very simple. I have included the direct paths for all of the headerfiles in include and its subdirectory cppconn.
using namespace std;
using namespace sql;
int main(){
Driver *driver;
Connection *con;
driver = get_driver_instance();
con = driver -> connect(host, username, password);
con -> setSchema(db);
con -> close(); }

The error: /tmp/cc1YxUfU.o: In function `main':
sqlTest.cpp:(.text+0xd): undefined reference to `sql::mysql::get_mysql_driver_instance()'
collect2: error: ld returned 1 exit status

I have tested a couple compile methods, but to no avail.
g++ sqlTest.cpp -o test
g++ -Wall -I/home/ryanh/mysql-connector-c++-noinstall-1.0.5-winx64/include/cppconn -o test sqlTest.cpp -L/home/ryanh/mysql-connector-c++-noinstall-1.0.5-winx64/lib

After some research some people suggested using -lmysqlcppconn, but I have no idea what that is or what it does. When I use it in the compile it says it does not exist.

A hello world compiles with the headers and runs without the use of any functions or anything.

I tried creating an object of driver class MySQL_Driver *driver and use its function get_mysql_driver_instance, but it has the same corresponding error saying it is an undefined reference.

Help would be appreciated thanks.

Viewing all articles
Browse latest Browse all 527

Trending Articles



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