undefined reference to `get_driver_instance'
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.
Subject
Views
Written By
Posted
undefined reference to `get_driver_instance'
3356
June 24, 2021 09:46AM
1117
June 24, 2021 09:50AM
1381
June 24, 2021 10:58AM
993
June 24, 2021 04:13PM
907
June 25, 2021 06:10AM
1151
June 25, 2021 07:40AM
987
June 25, 2021 07:49AM
1171
June 25, 2021 07:53AM
922
June 25, 2021 09:26AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.