Re: Error: undefined reference to get_driver_instance
Posted by:
nate givon
Date: February 09, 2010 05:51AM
I haven't been able to fix the problem either. I'm on windows 7 and installed the mysql-c++ connector via 64bit .msi. Building the following code with codeblocks mingw compiler:
#include <stdio.h>
#include <stdlib.h>
#include "mysql_connection.h"
#include "mysql_driver.h"
#include <cppconn\driver.h>
#include <cppconn\exception.h>
#include <cppconn\resultset.h>
#include <cppconn\statement.h>
#include <cppconn\prepared_statement.h>
using namespace std;
using namespace sql::mysql;
using namespace sql;
sql::Driver *driver;
sql::Connection *con;
sql::Statement *stmt;
sql::ResultSet *res;
sql::PreparedStatement *pstmt;
int main( int argc, char* argv[] )
{
driver = get_driver_instance();
printf("hello world\n");
return 0;
}
The compiler's build log:
mingw32-g++.exe -I"C:\Program Files\MySQL\MySQL Connector C++ 1.0.5\include" -I"C:\Program Files\MySQL\MySQL Connector C++ 1.0.5\lib\opt" -IC:\Users\nate\Desktop\auto -IC:\Users\nate\Desktop\auto\cppconn -IC:\Users\nate\Desktop\auto\Release -IC:\Users\nate\Desktop\auto -c C:\Users\nate\Desktop\auto\test.cpp -o C:\Users\nate\Desktop\auto\test.o
mingw32-g++.exe -L"C:\Program Files\MySQL\MySQL Connector C++ 1.0.5\include" -L"C:\Program Files\MySQL\MySQL Connector C++ 1.0.5\lib\opt" -LC:\Users\nate\Desktop\auto -LC:\Users\nate\Desktop\auto\cppconn -LC:\Users\nate\Desktop\auto\Release -o C:\Users\nate\Desktop\auto\test.exe C:\Users\nate\Desktop\auto\test.o "C:\Program Files\MySQL\MySQL Connector C++ 1.0.5\lib\opt\mysqlcppconn.lib" "C:\Program Files\MySQL\MySQL Connector C++ 1.0.5\lib\opt\mysqlcppconn-static.lib"
C:\Users\nate\Desktop\auto\test.o:test.cpp:(.text+0x129): undefined reference to `__imp__get_driver_instance'
collect2: ld returned 1 exit status
I know the issue is supposed to be with the linking of the mysql library "mysqlcppconn.lib", and it looks like the compiler is linking to it like I told codeblocks to do...can anybody see whats causing this problem?
Subject
Views
Written By
Posted
26143
June 03, 2009 09:27AM
19596
June 28, 2009 12:40AM
11921
July 03, 2009 03:18PM
10160
September 17, 2009 10:12AM
10736
September 22, 2009 03:36AM
11920
September 23, 2009 08:01AM
11455
September 23, 2009 04:51PM
7067
September 25, 2009 03:52PM
9510
January 15, 2010 05:34AM
6534
February 10, 2010 09:54AM
6641
April 22, 2010 03:01PM
8105
November 17, 2009 06:17AM
Re: Error: undefined reference to get_driver_instance
15217
February 09, 2010 05:51AM
7995
April 23, 2010 06:15PM
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.