Search code examples
c++mysqlreferenceundefinedmysql++

Mysql++ "undefined reference to __imp___ZN7mysqlpp10ConnectionC1Eb"


I am trying to install the mysql++ in Code::Blocks, but When I try to run the example code I get this error:

undefined reference to __imp___ZN7mysqlpp10ConnectionC1Eb

What I am doing wrong?


Solution

  • You must build MySQL++ with the exact same compiler and compiler options as you're using to build your program. What you're seeing is a name mangling and/or ABI mismatch due to mixing compilers and/or build options. This can be anything from a drastic error like trying to use a Visual C++ DLL with MinGW, to something more subtle like trying to use a MinGW DLL built with g++ 3.4.5 in a program you're building with MinGW g++ 4.4.

    Unlike C, C++ doesn't try to preserve binary compatibility between greatly different compilers.