List:MySQL on Win32« Previous MessageNext Message »
From:Miguel Cardenas Date:June 13 2012 2:39am
Subject:MySQL C API with Visual C++ 2010 - UNRESOLVED SYMBOLS
View as plain text  
Hello

I have troubles while trying to link my C application with mysql
client libraries using Visual C++ 2010 Express...

In the past I used VC++ 2008 Express and all I had to do was:

1. Add to the include path C:\Program Files\Mysql\...\include
2. Add to the library path C:\Program Files\Mysql\...\lib\opt
3. Add mysqlclient.lib and libmysql.lib to the list of aditional dependencies

Currently I am trying to build the same application but now using VC++
2010 and MySQL 5.5 using the same procedure but with this
configuration

1. Add to the include path C:\Program Files\MySQL\MySQL Server 5.5\include
2. Add to the library path C:\Program Files\MySQL\MySQL Server 5.5\lib (*)
3. Add mysqlclient.lib and libmysql.lib to the list of aditional dependencies

If I compile using the RELEASE output, I get lots of unresolved
symbols (all the ones related to the C API)

1>LIBWIN32.obj : error LNK2001: unresolved external symbol _mysql_close@4
1>LIBWIN32.obj : error LNK2001: unresolved external symbol _mysql_insert_id@4
1>LIBWIN32.obj : error LNK2001: unresolved external symbol _mysql_error@4
1>LIBWIN32.obj : error LNK2001: unresolved external symbol _mysql_row_tell@4
1>LIBWIN32.obj : error LNK2001: unresolved external symbol _mysql_use_result@4
1>LIBWIN32.obj : error LNK2001: unresolved external symbol _mysql_real_query@12
1>LIBWIN32.obj : error LNK2001: unresolved external symbol
_mysql_list_processes@4
1>LIBWIN32.obj : error LNK2001: unresolved external symbol _mysql_data_seek@12
1>LIBWIN32.obj : error LNK2001: unresolved external symbol _mysql_change_user@16
1>LIBWIN32.obj : error LNK2001: unresolved external symbol _mysql_eof@4
1>LIBWIN32.obj : error LNK2001: unresolved external symbol _mysql_fetch_row@4
1>LIBWIN32.obj : error LNK2001: unresolved external symbol
_mysql_real_connect@32
1>LIBWIN32.obj : error LNK2001: unresolved external symbol _mysql_list_tables@8
1>LIBWIN32.obj : error LNK2001: unresolved external symbol _mysql_store_result@4
1>LIBWIN32.obj : error LNK2001: unresolved external symbol _mysql_ping@4
1>LIBWIN32.obj : error LNK2001: unresolved external symbol _mysql_refresh@8
1>LIBWIN32.obj : error LNK2001: unresolved external symbol _mysql_list_dbs@8
1>LIBWIN32.obj : error LNK2001: unresolved external symbol _mysql_num_fields@4
1>LIBWIN32.obj : error LNK2001: unresolved external symbol _mysql_free_result@4
1>LIBWIN32.obj : error LNK2001: unresolved external symbol _mysql_shutdown@8
1>LIBWIN32.obj : error LNK2001: unresolved external symbol _mysql_options@12
1>LIBWIN32.obj : error LNK2001: unresolved external symbol
_mysql_fetch_lengths@4
1>LIBWIN32.obj : error LNK2001: unresolved external symbol _mysql_select_db@8
1>LIBWIN32.obj : error LNK2001: unresolved external symbol _mysql_row_seek@8
1>LIBWIN32.obj : error LNK2001: unresolved external symbol _mysql_errno@4
1>LIBWIN32.obj : error LNK2001: unresolved external symbol _mysql_init@4
1>LIBWIN32.obj : error LNK2001: unresolved external symbol _mysql_list_fields@12
1>LIBWIN32.obj : error LNK2001: unresolved external symbol _mysql_field_seek@8
1>LIBWIN32.obj : error LNK2001: unresolved external symbol
_mysql_affected_rows@4
1>LIBWIN32.obj : error LNK2001: unresolved external symbol _mysql_field_tell@4
1>LIBWIN32.obj : error LNK2001: unresolved external symbol _mysql_num_rows@4

If I use the debug version and choose instead C:\Program
Files\MySQL\MySQL Server 5.5\lib\Debug then does not find the
'libmysql.lib' library and such directory only contains
'mysqlclient.lib' and if I still use C:\Program Files\MySQL\MySQL
Server 5.5\lib\ then it keeps returning unresolved symbols...

What is the right way to link MySQL to my C aplication? I'm doing the
same way when used VC++ 2008 but does not work, and I'm confused on
the use of the release and debug version... is the ...\lib the release
version and ...\lib\Debug the debug one? if so, why the ...\lib\Debug
has no 'libmysql.lib' or should I use the one from the parent
directory? if so, should I include the ...\lib for the 'libmysql.lib'
and ...\lib\Debug for the 'mysqlclient.lib' debug version?

In VC++ 2008 works fine, I just have troubles with 2010...

Thanks for your help!
Thread
MySQL C API with Visual C++ 2010 - UNRESOLVED SYMBOLSMiguel Cardenas13 Jun