Bug #76338 undefined reference to `_imp__get_driver_instance'
Submitted: 16 Mar 2015 14:31 Modified: 9 Mar 2016 11:22
Reporter: xxxx xxxxx Email Updates:
Status: No Feedback Impact on me:
None 
Category:Connector / C++ Severity:S5 (Performance)
Version:1.1.5 OS:Any
Assigned to: Assigned Account CPU Architecture:Any
Tags: connector cpp mysql

[16 Mar 2015 14:31] xxxx xxxxx
Description:
I get this bug when I compile yours code:
undefined reference to `_imp__get_driver_instance'

I'm looking for solution for 3 days on internet, and no luck. 
I'm using windows 7 64 bit and Code::Blocks 13.12 with MinGW - GNU GCC compiler 32 bit, C++ MySQL connector 32 bit 1.1.5 and MySQL Server 5.5

This bug is wery old, because a lot of people on internet, don't know how to fix it.
I added MySQL server, mysql conector c++ and boost libs to Linker and Compiler.

Output:
||=== Build: Debug in MySQLexsample2 (compiler: GNU GCC Compiler) ===|
C:\Program Files (x86)\MySQL\MySQL Connector C++ 1.1.5\include\cppconn\warning.h|40|warning: ignoring #pragma warning  [-Wunknown-pragmas]|
C:\Program Files (x86)\MySQL\MySQL Connector C++ 1.1.5\include\cppconn\exception.h|48|warning: ignoring #pragma warning  [-Wunknown-pragmas]|
C:\Program Files (x86)\MySQL\MySQL Connector C++ 1.1.5\include\cppconn\exception.h|52|warning: ignoring #pragma warning  [-Wunknown-pragmas]|
C:\Program Files (x86)\MySQL\MySQL Connector C++ 1.1.5\include\cppconn\exception.h|53|warning: ignoring #pragma warning  [-Wunknown-pragmas]|
C:\Program Files (x86)\MySQL\MySQL Connector C++ 1.1.5\include\cppconn\exception.h|58|warning: ignoring #pragma warning  [-Wunknown-pragmas]|
obj\Debug\main.o||In function `main':|
C:\KONI\MySQLexsample2\main.cpp|54|undefined reference to `_imp__get_driver_instance'|
||=== Build failed: 1 error(s), 5 warning(s) (0 minute(s), 0 second(s)) ===|

How to repeat:
Run example 2 code from yours web page, on Code::Blocks IDE.

Create new console application on Code::Blocks IDE and paste code from webpage (http://dev.mysql.com/doc/connector-cpp/en/connector-cpp-examples-complete-example-2.html) to main.cpp file and compile.

Also add in compiler some libs ...
Settings->Compiler... (at top near Help button)
Search directories -> Compiler -> Add
C:\Program Files (x86)\MySQL\MySQL Connector C++ 1.1.5\include\
C:\Program Files (x86)\MySQL\MySQL Connector C++ 1.1.5\include\cppconn\
C:\Program Files (x86)\MySQL\MySQL Server 5.5\include
C:\boost_1_57_0

Search directories -> Linker -> Add
C:\Program Files (x86)\MySQL\MySQL Connector C++ 1.1.5\lib\
C:\Program Files (x86)\MySQL\MySQL Server 5.5\lib
C:\boost_1_57_0\libs

Then in Linker Settings add 
-lmysqlclient 

Then press OK and F9

Also I have to comment some lines in C:\Program Files (x86)\MySQL\MySQL Connector C++ 1.1.5\include\cppconn\config.h 
//#ifdef HAVE_MS_INT32
//typedef __int32			int32_t;
//#endif

//#ifdef HAVE_MS_UINT32
//typedef unsigned __int32	uint32_t;
//#endif

Suggested fix:
none 
(I would like to know solution ...)
[21 Jul 2015 12:44] Ingolf Tippner
I have Code::Blocks 13.12, MinGW, Win7 64bit.
I used the Windows 64bit Connector for C++, installed boost.
It compiles perfectly, but the build breaks in 
undefined reference in _imp__get_driver_instance

mingw32-g++.exe -LC:\Users\Public\mysql_connector\lib -LC:\Users\Public\wxWidgets-2.9.4\lib\gcc_dll -L( -o bin\Debug\BeamiMan.exe obj\Debug\BeamiManApp.o obj\Debug\BeamiManMain.o obj\Debug\src\mysql_db.o  obj\Debug\resource.res -mthreads -lmysqlcppconn -lmysqlcppconn-static  -lwxmsw29u -mwindows
obj\Debug\src\mysql_db.o: In function `Z7init_dbv':
undefined reference in _imp__get_driver_instance
[9 Feb 2016 11:22] Chiranjeevi Battula
Hello xxxx xxxxx,

Thank you for the bug report.
I tried to reproduce the issue at my end using MySQL 5.7.10, Connector / C++ 1.1.7, Code::Blocks 16.01 but not seeing any issues to connect MySQL and Drivers.
Could you please provide repeatable test case (exact C++ Sample code, MySQL version etc. - please make it as private if you prefer) to confirm this issue at our end?

Thanks,
Chiranjeevi.
[10 Mar 2016 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".