I'm getting unresolved external symbol error when linking my code with MySQL Connector C++ 1.1.0.
Here's the error message:
6>database.lib(db_manager.obj) : error LNK2019: unresolved external symbol
"class sql::mysql::MySQL_Driver * __cdecl sql::mysql::get_driver_instance(void)" (?get_driver_instance@mysql@sql@@YAPAVMySQL_Driver@12@XZ)
referenced in function "class sql::mysql::MySQL_Driver * __cdecl sql::mysql::get_mysql_driver_instance(void)" (?get_mysql_driver_instance@mysql@sql@@YAPAVMySQL_Driver@12@XZ)
I used dumpbin
to get a list of symbols in the mysqlconn-static.lib and found a similar symbol:
COMDAT; sym= "class sql::mysql::MySQL_Driver * __cdecl sql::mysql::get_driver_instance(void)" (?get_driver_instance@mysql@sql@@YAPEAVMySQL_Driver@12@XZ)
When these two lines are lined up, the difference looks like:
(?get_driver_instance@mysql@sql@@YAPEAVMySQL_Driver@12@XZ)
(?get_driver_instance@mysql@sql@@YAPAVMySQL_Driver@12@XZ)
What is the difference in Name Managling between YAPEAV
AND YAPAV
?
I have an idea that my issue is related to incompatiblities between the MySQL Connector library and how I'm building my code.
I searched the web and found a bug against MySQL Connector 1.1.0, but it was changed to "not a bug".
I am using Visual Studio 2010 compiling to a 32-bit target using a 64-bit platform.
The MySQL Connector C++ is version 1.1.0.
The MSVC tool undname
is your friend. Using it, you find that
?get_driver_instance@mysql@sql@@YAPEAVMySQL_Driver@12@XZ
corresponds to:
class sql::mysql::MySQL_Driver * __ptr64 __cdecl sql::mysql::get_driver_instance(void)
?get_driver_instance@mysql@sql@@YAPAVMySQL_Driver@12@XZ
corresponds to:
class sql::mysql::MySQL_Driver * __cdecl sql::mysql::get_driver_instance(void)
The difference being a __ptr64
decoration. It seems like you're building a 32-bit program but linking against a library built for a 64-bit target.