MySQL++Mysql++ and mingw32-make error during library compilation
(1.1) Originally by marcus (marcusbarnet) with edits by Warren Young (tangent) on 2020-06-08 01:15:45 from 1.0 [link] [source]
It's my first time on Windows and I'm trying to compile the Mysql++ library by using mingw32. I've downloaded the tarball archive and then I run the command mingw32-make -f Makefile.mingw as specified in the documentation, but I get different undefined reference errors. This same library works fine on Ubuntu and I had no problems during the building.
I installed the MySQL Connector C 6.1 as requested and its path is C:Program FilesMySQLMySQL Connector C 6.1.
mysql++-3.2.5\mysql++-3.2.5>mingw32-make.exe -f Makefile.mingw
g++ -shared -fPIC -o mysqlpp.dll mysqlpp_beemutex.o mysqlpp_cmdline.o mysqlpp_connection.o mysqlpp_cpool.o mysqlpp_datetime.o mysqlpp_dbdriver.o mysqlpp_field_names.o mysqlpp_field_types.o mysqlpp_manip.o mysqlpp_myset.o mysqlpp_mysql++.o mysqlpp_mystring.o mysqlpp_null.o mysqlpp_options.o mysqlpp_qparms.o mysqlpp_query.o mysqlpp_result.o mysqlpp_row.o mysqlpp_scopedconnection.o mysqlpp_sql_buffer.o mysqlpp_sqlstream.o mysqlpp_ssqls2.o mysqlpp_stadapter.o mysqlpp_tcp_connection.o mysqlpp_transaction.o mysqlpp_type_info.o mysqlpp_uds_connection.o mysqlpp_utility.o mysqlpp_vallist.o mysqlpp_wnp_connection.o -Wl,--out-implib=libmysqlpp.a -g -mthreads -Wl,--enable-stdcall-fixup -L"C:\Program Files\MySQL\MySQL Connector C 6.1\lib" -lwsock32 -lmysql
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: mysqlpp_connection.o: in function `ZNK7mysqlpp8DBDriver14client_versionB5cxx11Ev':
C:\Users\39328\Downloads\mysql++-3.2.5\mysql++-3.2.5/lib/dbdriver.h:97: undefined reference to `mysql_get_client_info@0'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: mysqlpp_connection.o: in function `ZN7mysqlpp8DBDriver5errorEv':
C:\Users\39328\Downloads\mysql++-3.2.5\mysql++-3.2.5/lib/dbdriver.h:185: undefined reference to `mysql_error@4'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: mysqlpp_connection.o: in function `ZN7mysqlpp8DBDriver6errnumEv':
C:\Users\39328\Downloads\mysql++-3.2.5\mysql++-3.2.5/lib/dbdriver.h:192: undefined reference to `mysql_errno@4'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: mysqlpp_connection.o: in function `ZN7mysqlpp8DBDriver8ipc_infoB5cxx11Ev':
C:\Users\39328\Downloads\mysql++-3.2.5\mysql++-3.2.5/lib/dbdriver.h:366: undefined reference to `mysql_get_host_info@4'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: mysqlpp_connection.o: in function `ZN7mysqlpp8DBDriver4killEm':
C:\Users\39328\Downloads\mysql++-3.2.5\mysql++-3.2.5/lib/dbdriver.h:395: undefined reference to `mysql_kill@8'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: mysqlpp_connection.o: in function `ZN7mysqlpp8DBDriver4pingEv':
C:\Users\39328\Downloads\mysql++-3.2.5\mysql++-3.2.5/lib/dbdriver.h:466: undefined reference to `mysql_ping@4'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: mysqlpp_connection.o: in function `ZN7mysqlpp8DBDriver16protocol_versionEv':
C:\Users\39328\Downloads\mysql++-3.2.5\mysql++-3.2.5/lib/dbdriver.h:476: undefined reference to `mysql_get_proto_info@4'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: mysqlpp_connection.o: in function `ZN7mysqlpp8DBDriver9select_dbEPKc':
C:\Users\39328\Downloads\mysql++-3.2.5\mysql++-3.2.5/lib/dbdriver.h:512: undefined reference to `mysql_select_db@8'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: mysqlpp_connection.o: in function `ZN7mysqlpp8DBDriver14server_versionB5cxx11Ev':
C:\Users\39328\Downloads\mysql++-3.2.5\mysql++-3.2.5/lib/dbdriver.h:521: undefined reference to `mysql_get_server_info@4'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: mysqlpp_connection.o: in function `ZN7mysqlpp8DBDriver13server_statusB5cxx11Ev':
C:\Users\39328\Downloads\mysql++-3.2.5\mysql++-3.2.5/lib/dbdriver.h:597: undefined reference to `mysql_stat@4'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: mysqlpp_connection.o: in function `ZN7mysqlpp8DBDriver10thread_endEv':
C:\Users\39328\Downloads\mysql++-3.2.5\mysql++-3.2.5/lib/dbdriver.h:633: undefined reference to `mysql_thread_end@0'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: mysqlpp_connection.o: in function `ZN7mysqlpp8DBDriver9thread_idEv':
C:\Users\39328\Downloads\mysql++-3.2.5\mysql++-3.2.5/lib/dbdriver.h:644: undefined reference to `mysql_thread_id@4'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: mysqlpp_connection.o: in function `ZN7mysqlpp8DBDriver12thread_startEv':
C:\Users\39328\Downloads\mysql++-3.2.5\mysql++-3.2.5/lib/dbdriver.h:668: undefined reference to `mysql_thread_init@0'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: mysqlpp_dbdriver.o: in function `ZN7mysqlpp8DBDriver7connectEPKcS2_jS2_S2_S2_':
C:\Users\39328\Downloads\mysql++-3.2.5\mysql++-3.2.5/lib/dbdriver.cpp:76: undefined reference to `mysql_real_connect@32'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: mysqlpp_dbdriver.o: in function `ZN7mysqlpp8DBDriver7connectERK8st_mysql':
C:\Users\39328\Downloads\mysql++-3.2.5\mysql++-3.2.5/lib/dbdriver.cpp:86: undefined reference to `mysql_real_connect@32'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: mysqlpp_dbdriver.o: in function `ZN7mysqlpp8DBDriver15connect_prepareEv':
C:\Users\39328\Downloads\mysql++-3.2.5\mysql++-3.2.5/lib/dbdriver.cpp:102: undefined reference to `mysql_init@4'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: mysqlpp_dbdriver.o: in function `ZN7mysqlpp8DBDriver10disconnectEv':
C:\Users\39328\Downloads\mysql++-3.2.5\mysql++-3.2.5/lib/dbdriver.cpp:137: undefined reference to `mysql_close@4'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: mysqlpp_dbdriver.o: in function `ZN7mysqlpp8DBDriver10enable_sslEPKcS2_S2_S2_S2_':
C:\Users\39328\Downloads\mysql++-3.2.5\mysql++-3.2.5/lib/dbdriver.cpp:151: undefined reference to `mysql_ssl_set@24'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: mysqlpp_dbdriver.o: in function `ZN7mysqlpp8DBDriver10query_infoB5cxx11Ev':
C:\Users\39328\Downloads\mysql++-3.2.5\mysql++-3.2.5/lib/dbdriver.cpp:237: undefined reference to `mysql_info@4'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: mysqlpp_dbdriver.o: in function `ZN7mysqlpp8DBDriver8shutdownEv':
C:\Users\39328\Downloads\mysql++-3.2.5\mysql++-3.2.5/lib/dbdriver.cpp:343: undefined reference to `mysql_shutdown@8'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: mysqlpp_dbdriver.o: in function `ZN7mysqlpp8DBDriver12thread_awareEv':
C:\Users\39328\Downloads\mysql++-3.2.5\mysql++-3.2.5/lib/dbdriver.cpp:357: undefined reference to `mysql_thread_safe@0'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: mysqlpp_dbdriver.o: in function `ZN7mysqlpp8DBDriver13escape_stringEPcPKcj':
C:\Users\39328\Downloads\mysql++-3.2.5\mysql++-3.2.5/lib/dbdriver.h:214: undefined reference to `mysql_real_escape_string@16'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: mysqlpp_dbdriver.o: in function `ZN7mysqlpp8DBDriver21escape_string_no_connEPcPKcj':
C:\Users\39328\Downloads\mysql++-3.2.5\mysql++-3.2.5/lib/dbdriver.h:269: undefined reference to `mysql_escape_string@12'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: mysqlpp_options.o: in function `ZN7mysqlpp8DBDriver10set_optionE12mysql_optionPKv':
C:\Users\39328\Downloads\mysql++-3.2.5\mysql++-3.2.5/lib/dbdriver.h:540: undefined reference to `mysql_options@12'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: mysqlpp_options.o: in function `ZN7mysqlpp8DBDriver10set_optionE21enum_mysql_set_option':
C:\Users\39328\Downloads\mysql++-3.2.5\mysql++-3.2.5/lib/dbdriver.h:551: undefined reference to `mysql_set_server_option@8'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: mysqlpp_query.o: in function `ZNK7mysqlpp26RefCountedPointerDestroyerI12st_mysql_resEclEPS1_':
C:\Users\39328\Downloads\mysql++-3.2.5\mysql++-3.2.5/lib/result.h:287: undefined reference to `mysql_free_result@4'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: mysqlpp_query.o: in function `ZN7mysqlpp8DBDriver13affected_rowsEv':
C:\Users\39328\Downloads\mysql++-3.2.5\mysql++-3.2.5/lib/dbdriver.h:88: undefined reference to `mysql_affected_rows@4'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: mysqlpp_query.o: in function `ZN7mysqlpp8DBDriver7executeEPKcj':
C:\Users\39328\Downloads\mysql++-3.2.5\mysql++-3.2.5/lib/dbdriver.h:287: undefined reference to `mysql_real_query@12'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: mysqlpp_query.o: in function `ZN7mysqlpp8DBDriver9insert_idEv':
C:\Users\39328\Downloads\mysql++-3.2.5\mysql++-3.2.5/lib/dbdriver.h:382: undefined reference to `mysql_insert_id@4'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: mysqlpp_query.o: in function `ZN7mysqlpp8DBDriver12more_resultsEv':
C:\Users\39328\Downloads\mysql++-3.2.5\mysql++-3.2.5/lib/dbdriver.h:406: undefined reference to `mysql_more_results@4'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: mysqlpp_query.o: in function `ZN7mysqlpp8DBDriver11next_resultEv':
C:\Users\39328\Downloads\mysql++-3.2.5\mysql++-3.2.5/lib/dbdriver.h:425: undefined reference to `mysql_next_result@4'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: mysqlpp_query.o: in function `ZN7mysqlpp8DBDriver12result_emptyEv':
C:\Users\39328\Downloads\mysql++-3.2.5\mysql++-3.2.5/lib/dbdriver.h:505: undefined reference to `mysql_field_count@4'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: mysqlpp_query.o: in function `ZN7mysqlpp8DBDriver12store_resultEv':
C:\Users\39328\Downloads\mysql++-3.2.5\mysql++-3.2.5/lib/dbdriver.h:610: undefined reference to `mysql_store_result@4'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: mysqlpp_query.o: in function `ZN7mysqlpp8DBDriver10use_resultEv':
C:\Users\39328\Downloads\mysql++-3.2.5\mysql++-3.2.5/lib/dbdriver.h:684: undefined reference to `mysql_use_result@4'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: mysqlpp_result.o: in function `ZNK7mysqlpp8DBDriver9fetch_rowEP12st_mysql_res':
C:\Users\39328\Downloads\mysql++-3.2.5\mysql++-3.2.5/lib/dbdriver.h:301: undefined reference to `mysql_fetch_row@4'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: mysqlpp_result.o: in function `ZNK7mysqlpp8DBDriver13fetch_lengthsEP12st_mysql_res':
C:\Users\39328\Downloads\mysql++-3.2.5\mysql++-3.2.5/lib/dbdriver.h:311: undefined reference to `mysql_fetch_lengths@4'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: mysqlpp_result.o: in function `ZNK7mysqlpp8DBDriver11fetch_fieldEP12st_mysql_resj':
C:\Users\39328\Downloads\mysql++-3.2.5\mysql++-3.2.5/lib/dbdriver.h:330: undefined reference to `mysql_fetch_field@4'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:\Users\39328\Downloads\mysql++-3.2.5\mysql++-3.2.5/lib/dbdriver.h:331: undefined reference to `mysql_fetch_field_direct@8'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: mysqlpp_result.o: in function `ZNK7mysqlpp8DBDriver10field_seekEP12st_mysql_resj':
C:\Users\39328\Downloads\mysql++-3.2.5\mysql++-3.2.5/lib/dbdriver.h:341: undefined reference to `mysql_field_seek@8'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: mysqlpp_result.o: in function `ZNK7mysqlpp8DBDriver11free_resultEP12st_mysql_res':
C:\Users\39328\Downloads\mysql++-3.2.5\mysql++-3.2.5/lib/dbdriver.h:350: undefined reference to `mysql_free_result@4'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: mysqlpp_result.o: in function `ZNK7mysqlpp8DBDriver10num_fieldsEP12st_mysql_res':
C:\Users\39328\Downloads\mysql++-3.2.5\mysql++-3.2.5/lib/dbdriver.h:441: undefined reference to `mysql_num_fields@4'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: mysqlpp_result.o: in function `ZNK7mysqlpp8DBDriver8num_rowsEP12st_mysql_res':
C:\Users\39328\Downloads\mysql++-3.2.5\mysql++-3.2.5/lib/dbdriver.h:450: undefined reference to `mysql_num_rows@4'
collect2.exe: error: ld returned 1 exit status
Makefile.mingw:361: recipe for target 'mysqlpp.dll' failed
mingw32-make.exe: *** [mysqlpp.dll] Error 1
How can I solve this error?
(2) By Warren Young (tangent) on 2020-06-08 01:19:30 in reply to 1.1 [link] [source]
This typically means you've got a mismatch in the word sizes between the shipped *.def
file and the MySQL C API DLL you're using on that machine.
Complicating the problem is that 64-bit MinGW always has this difference relative to 32-bit MinGW, so no matter what, the def
file contents will always be wrong for one of them.
There may be a way to make MinGW's linker link to the DLL directly instead of via an import library, but you'd need to pursue that yourself. MinGW is not a primary development platform for MySQL++.
Alternately, you can take that hint and give MinGW a miss. Your other three major options on Windows — Visual C++, Cygwin, and WSL — are not going to have these problems.
(3.1) Originally by marcus (marcusbarnet) with edits by Warren Young (tangent) on 2020-07-04 21:38:37 from 3.0 in reply to 2 [link] [source]
Thank you for your reply. I tried to switch to Visual Studio, so I installed Microsoft Visual Studio 2017, v15.9.5 and I opened the file contained in the folder vc2008. It asked me to upgrade the project in order to continue to open the files. After that, I tried to build the solution, but I received the folllowing errors.
Why this happen? Is there any way to solve it?
Thank you.
1>------ Rebuild All started: Project: mysqlpp, Configuration: Release x64 ------
1>beemutex.cpp
1>cmdline.cpp
1>connection.cpp
1>cpool.cpp
1>datetime.cpp
1>dbdriver.cpp
1>field_names.cpp
1>field_types.cpp
1>manip.cpp
1>myset.cpp
1>mysql++.cpp
1>mystring.cpp
1>null.cpp
1>options.cpp
1>qparms.cpp
1>query.cpp
1>result.cpp
1>row.cpp
1>scopedconnection.cpp
1>sqlstream.cpp
1>sql_buffer.cpp
1>ssqls2.cpp
1>stadapter.cpp
1>tcp_connection.cpp
1>transaction.cpp
1>type_info.cpp
1>uds_connection.cpp
1>utility.cpp
1>vallist.cpp
1>wnp_connection.cpp
1> Creating library x64\Release\mysqlpp.lib and object x64\Release\mysqlpp.exp
1>mysql++_mysqlpp.vcxproj -> C:\mysql++-3.2.5\vc2008\x64\Release\mysqlpp.dll
2>------ Rebuild All started: Project: ssqls2parse, Configuration: Release x64 ------
3>------ Rebuild All started: Project: excommon, Configuration: Release x64 ------
4>------ Rebuild All started: Project: test_array_index, Configuration: Release x64 ------
5>------ Rebuild All started: Project: test_cpool, Configuration: Release x64 ------
6>------ Rebuild All started: Project: test_datetime, Configuration: Release x64 ------
7>------ Rebuild All started: Project: test_inttypes, Configuration: Release x64 ------
8>------ Rebuild All started: Project: test_insertpolicy, Configuration: Release x64 ------
9>------ Rebuild All started: Project: test_manip, Configuration: Release x64 ------
10>------ Rebuild All started: Project: test_null_comparison, Configuration: Release x64 ------
11>------ Rebuild All started: Project: test_query_copy, Configuration: Release x64 ------
12>------ Rebuild All started: Project: test_qssqls, Configuration: Release x64 ------
13>------ Rebuild All started: Project: test_qstream, Configuration: Release x64 ------
3>printdata.cpp
2>parsev2.cpp
5>cpool.cpp
4>array_index.cpp
7>inttypes.cpp
6>datetime.cpp
9>manip.cpp
8>insertpolicy.cpp
12>qssqls.cpp
10>null_comparison.cpp
11>query_copy.cpp
13>qstream.cpp
7>LINK : fatal error LNK1181: cannot open input file 'mysqlpp.lib'
5>LINK : fatal error LNK1181: cannot open input file 'mysqlpp.lib'
5>Done building project "mysql++_test_cpool.vcxproj" -- FAILED.
7>Done building project "mysql++_test_inttypes.vcxproj" -- FAILED.
14>------ Rebuild All started: Project: test_sqlstream, Configuration: Release x64 ------
15>------ Rebuild All started: Project: test_string, Configuration: Release x64 ------
14>sqlstream.cpp
15>string.cpp
3>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppBuild.targets(1397,5): warning MSB8012: TargetPath(C:\mysql++-3.2.5\vc2008\x64\Release\excommon.lib) does not match the Library's OutputFile property value (C:\mysql++-3.2.5\vc2008\x64\Release\mysqlpp_excommon.lib). This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Lib.OutputFile).
8>LINK : fatal error LNK1181: cannot open input file 'mysqlpp.lib'
3>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppBuild.targets(1399,5): warning MSB8012: TargetName(excommon) does not match the Library's OutputFile property value (mysqlpp_excommon). This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Lib.OutputFile).
8>Done building project "mysql++_test_insertpolicy.vcxproj" -- FAILED.
16>------ Rebuild All started: Project: test_tcp, Configuration: Release x64 ------
3>mysql++_excommon.vcxproj -> C:\mysql++-3.2.5\vc2008\x64\Release\excommon.lib
6>LINK : fatal error LNK1181: cannot open input file 'mysqlpp.lib'
3>Done building project "mysql++_excommon.vcxproj".
17>------ Rebuild All started: Project: test_uds, Configuration: Release x64 ------
6>Done building project "mysql++_test_datetime.vcxproj" -- FAILED.
18>------ Rebuild All started: Project: test_wnp, Configuration: Release x64 ------
10>LINK : fatal error LNK1181: cannot open input file 'mysqlpp.lib'
10>Done building project "mysql++_test_null_comparison.vcxproj" -- FAILED.
11>LINK : fatal error LNK1181: cannot open input file 'mysqlpp.lib'
11>Done building project "mysql++_test_query_copy.vcxproj" -- FAILED.
19>------ Rebuild All started: Project: cgi_jpeg, Configuration: Release x64 ------
20>------ Rebuild All started: Project: cpool, Configuration: Release x64 ------
16>tcp.cpp
9>LINK : fatal error LNK1181: cannot open input file 'mysqlpp.lib'
9>Done building project "mysql++_test_manip.vcxproj" -- FAILED.
13>LINK : fatal error LNK1181: cannot open input file 'mysqlpp.lib'
21>------ Rebuild All started: Project: dbinfo, Configuration: Release x64 ------
13>Done building project "mysql++_test_qstream.vcxproj" -- FAILED.
22>------ Rebuild All started: Project: deadlock, Configuration: Release x64 ------
17>uds.cpp
18>wnp.cpp
19>cgi_jpeg.cpp
12>LINK : fatal error LNK1181: cannot open input file 'mysqlpp.lib'
12>Done building project "mysql++_test_qssqls.vcxproj" -- FAILED.
23>------ Rebuild All started: Project: fieldinf, Configuration: Release x64 ------
20>cpool.cpp
21>dbinfo.cpp
22>deadlock.cpp
23>fieldinf.cpp
16>LINK : fatal error LNK1181: cannot open input file 'mysqlpp.lib'
16>Done building project "mysql++_test_tcp.vcxproj" -- FAILED.
24>------ Rebuild All started: Project: for_each, Configuration: Release x64 ------
17>LINK : fatal error LNK1181: cannot open input file 'mysqlpp.lib'
17>Done building project "mysql++_test_uds.vcxproj" -- FAILED.
25>------ Rebuild All started: Project: load_jpeg, Configuration: Release x64 ------
2>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppBuild.targets(1397,5): warning MSB8012: TargetPath(C:\mysql++-3.2.5\vc2008\x64\Release\ssqls2parse.lib) does not match the Library's OutputFile property value (C:\mysql++-3.2.5\vc2008\x64\Release\mysqlpp_ssqls2parse.lib). This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Lib.OutputFile).
2>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppBuild.targets(1399,5): warning MSB8012: TargetName(ssqls2parse) does not match the Library's OutputFile property value (mysqlpp_ssqls2parse). This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Lib.OutputFile).
24>for_each.cpp
25>load_jpeg.cpp
2>mysql++_ssqls2parse.vcxproj -> C:\mysql++-3.2.5\vc2008\x64\Release\ssqls2parse.lib
4>LINK : fatal error LNK1181: cannot open input file 'mysqlpp.lib'
4>Done building project "mysql++_test_array_index.vcxproj" -- FAILED.
26>------ Rebuild All started: Project: multiquery, Configuration: Release x64 ------
15>LINK : fatal error LNK1181: cannot open input file 'mysqlpp.lib'
15>Done building project "mysql++_test_string.vcxproj" -- FAILED.
2>Done building project "mysql++_ssqls2parse.vcxproj".
27>------ Rebuild All started: Project: resetdb, Configuration: Release x64 ------
28>------ Rebuild All started: Project: ssqlsxlat, Configuration: Release x64 ------
14>LINK : fatal error LNK1181: cannot open input file 'mysqlpp.lib'
14>Done building project "mysql++_test_sqlstream.vcxproj" -- FAILED.
29>------ Rebuild All started: Project: test_ssqls2, Configuration: Release x64 ------
26>multiquery.cpp
27>resetdb.cpp
18>LINK : fatal error LNK1181: cannot open input file 'mysqlpp.lib'
18>Done building project "mysql++_test_wnp.vcxproj" -- FAILED.
30>------ Rebuild All started: Project: simple1, Configuration: Release x64 ------
28>genv2.cpp
28>main.cpp
19>LINK : fatal error LNK1181: cannot open input file 'mysqlpp_excommon.lib'
19>Done building project "mysql++_cgi_jpeg.vcxproj" -- FAILED.
31>------ Rebuild All started: Project: simple2, Configuration: Release x64 ------
20>LINK : fatal error LNK1181: cannot open input file 'mysqlpp_excommon.lib'
22>LINK : fatal error LNK1181: cannot open input file 'mysqlpp_excommon.lib'
20>Done building project "mysql++_cpool.vcxproj" -- FAILED.
32>------ Rebuild All started: Project: simple3, Configuration: Release x64 ------
22>Done building project "mysql++_deadlock.vcxproj" -- FAILED.
29>ssqls2.cpp
33>------ Rebuild All started: Project: ssqls1, Configuration: Release x64 ------
30>simple1.cpp
23>LINK : fatal error LNK1181: cannot open input file 'mysqlpp_excommon.lib'
21>LINK : fatal error LNK1181: cannot open input file 'mysqlpp_excommon.lib'
21>Done building project "mysql++_dbinfo.vcxproj" -- FAILED.
34>------ Rebuild All started: Project: ssqls2, Configuration: Release x64 ------
23>Done building project "mysql++_fieldinf.vcxproj" -- FAILED.
35>------ Rebuild All started: Project: ssqls3, Configuration: Release x64 ------
31>simple2.cpp
32>simple3.cpp
33>ssqls1.cpp
35>ssqls3.cpp
34>ssqls2.cpp
26>c:\mysql++-3.2.5\examples\multiquery.cpp(101): warning C4267: 'argument': conversion from 'size_t' to 'unsigned int', possible loss of data
26>c:\mysql++-3.2.5\examples\multiquery.cpp(102): warning C4267: 'argument': conversion from 'size_t' to 'int', possible loss of data
24>LINK : fatal error LNK1181: cannot open input file 'mysqlpp_excommon.lib'
24>Done building project "mysql++_for_each.vcxproj" -- FAILED.
36>------ Rebuild All started: Project: ssqls4, Configuration: Release x64 ------
28>LINK : fatal error LNK1181: cannot open input file 'mysqlpp.lib'
28>Done building project "mysql++_ssqlsxlat.vcxproj" -- FAILED.
37>------ Rebuild All started: Project: ssqls5, Configuration: Release x64 ------
25>LINK : fatal error LNK1181: cannot open input file 'mysqlpp_excommon.lib'
25>Done building project "mysql++_load_jpeg.vcxproj" -- FAILED.
38>------ Rebuild All started: Project: ssqls6, Configuration: Release x64 ------
36>ssqls4.cpp
37>ssqls5.cpp
38>ssqls6.cpp
26>LINK : fatal error LNK1181: cannot open input file 'mysqlpp_excommon.lib'
26>Done building project "mysql++_multiquery.vcxproj" -- FAILED.
39>------ Rebuild All started: Project: store_if, Configuration: Release x64 ------
30>LINK : fatal error LNK1181: cannot open input file 'mysqlpp_excommon.lib'
39>store_if.cpp
31>LINK : fatal error LNK1181: cannot open input file 'mysqlpp_excommon.lib'
29>LINK : fatal error LNK1181: cannot open input file 'mysqlpp.lib'
31>Done building project "mysql++_simple2.vcxproj" -- FAILED.
40>------ Rebuild All started: Project: tquery1, Configuration: Release x64 ------
30>Done building project "mysql++_simple1.vcxproj" -- FAILED.
29>Done building project "mysql++_test_ssqls2.vcxproj" -- FAILED.
41>------ Rebuild All started: Project: tquery2, Configuration: Release x64 ------
42>------ Rebuild All started: Project: tquery3, Configuration: Release x64 ------
32>LINK : fatal error LNK1181: cannot open input file 'mysqlpp_excommon.lib'
32>Done building project "mysql++_simple3.vcxproj" -- FAILED.
43>------ Rebuild All started: Project: tquery4, Configuration: Release x64 ------
40>tquery1.cpp
42>tquery3.cpp
41>tquery2.cpp
33>LINK : fatal error LNK1181: cannot open input file 'mysqlpp_excommon.lib'
33>Done building project "mysql++_ssqls1.vcxproj" -- FAILED.
44>------ Rebuild All started: Project: transaction, Configuration: Release x64 ------
43>tquery4.cpp
44>transaction.cpp
35>LINK : fatal error LNK1181: cannot open input file 'mysqlpp_excommon.lib'
35>Done building project "mysql++_ssqls3.vcxproj" -- FAILED.
36>LINK : fatal error LNK1181: cannot open input file 'mysqlpp_excommon.lib'
36>Done building project "mysql++_ssqls4.vcxproj" -- FAILED.
27>LINK : fatal error LNK1181: cannot open input file 'mysqlpp_excommon.lib'
27>Done building project "mysql++_resetdb.vcxproj" -- FAILED.
37>LINK : fatal error LNK1181: cannot open input file 'mysqlpp_excommon.lib'
38>LINK : fatal error LNK1181: cannot open input file 'mysqlpp_excommon.lib'
37>Done building project "mysql++_ssqls5.vcxproj" -- FAILED.
38>Done building project "mysql++_ssqls6.vcxproj" -- FAILED.
39>LINK : fatal error LNK1181: cannot open input file 'mysqlpp_excommon.lib'
40>LINK : fatal error LNK1181: cannot open input file 'mysqlpp_excommon.lib'
42>LINK : fatal error LNK1181: cannot open input file 'mysqlpp_excommon.lib'
39>Done building project "mysql++_store_if.vcxproj" -- FAILED.
40>Done building project "mysql++_tquery1.vcxproj" -- FAILED.
42>Done building project "mysql++_tquery3.vcxproj" -- FAILED.
41>LINK : fatal error LNK1181: cannot open input file 'mysqlpp_excommon.lib'
41>Done building project "mysql++_tquery2.vcxproj" -- FAILED.
43>LINK : fatal error LNK1181: cannot open input file 'mysqlpp_excommon.lib'
43>Done building project "mysql++_tquery4.vcxproj" -- FAILED.
34>LINK : fatal error LNK1181: cannot open input file 'mysqlpp_excommon.lib'
34>Done building project "mysql++_ssqls2.vcxproj" -- FAILED.
44>LINK : fatal error LNK1181: cannot open input file 'mysqlpp_excommon.lib'
44>Done building project "mysql++_transaction.vcxproj" -- FAILED.
========== Rebuild All: 3 succeeded, 41 failed, 0 skipped ==========
(4.1) By Warren Young (tangent) on 2022-05-25 05:56:29 edited from 4.0 in reply to 3.1 [source]
Why this happen?
Because the Visual Studio developers haven't bothered to write their project conversion tools robustly enough that they get everything right across the span of versions from 2008 to 2019.
(We're stuck with 2008 as the output format of our build system due to a limitation in that build system.)
Is there any way to solve it?
Manually fix up the errors, which are pretty clearly spelled out in the errors you're getting. Example:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppBuild.targets(1397,5): warning MSB8012: TargetPath(C:\mysql++-3.2.5\vc2008\x64\Release\excommon.lib) does not match the Library's OutputFile property value (C:\mysql++-3.2.5\vc2008\x64\Release\mysqlpp_excommon.lib)
That's telling you that the place the converted project is actually putting the compiled mysqlpp_excommon.lib
is not the place the linker is looking for it. Either change where the compiler puts it, or change where the linker looks for it.
(This project file is fine in older versions of VC++. It's just the ones in the past few years that have gotten this wrong on conversion.)
Alternately, create your own Visual Studio "solution" and add the MySQL++ files to a library project inside it.
(5.1) Originally by marcus (marcusbarnet) with edits by Warren Young (tangent) on 2020-07-07 05:03:06 from 5.0 in reply to 4.0 [link] [source]
I really appreciate your help! Thank you a lot, I was able to successfully compile the libray under VS 2017. I changed the path as it was expecting and I got no errors.
I'm able to correctly compile programs and examples under Visual Studio, but I always receive errors when I try to compile it by using Codeblocks (mingw). I thought that I could compile the code by using mingw and the compiled libraries, but I was wrong.
It always gives me this errors:
-------------- Build: Debug in Pump (compiler: GNU GCC Compiler)---------------
mingw32-g++.exe -LC:\wxWidgets-3.1.3\lib\gcc_dll -L..\..\..\..\..\wxWidgets-3.1.3\lib -L..\..\..\..\..\MinGW\lib -L..\..\..\..\..\mysql++-3.2.5\vc2008\x64\Release -L"..\..\..\..\..\Program Files\MySQL\MySQL Connector C 6.1\lib" -o bin\Debug\Pump.exe obj\Debug\firstpanel.o obj\Debug\Page1Scrolled.o obj\Debug\PumpApp.o obj\Debug\PumpMain.o obj\Debug\resource.res -mthreads ..\..\..\..\..\wxWidgets-3.1.3\lib\gcc_dll\libwxbase31u.a ..\..\..\..\..\wxWidgets-3.1.3\lib\gcc_dll\libwxbase31u_net.a ..\..\..\..\..\wxWidgets-3.1.3\lib\gcc_dll\libwxbase31u_xml.a ..\..\..\..\..\wxWidgets-3.1.3\lib\gcc_dll\libwxexpat.a ..\..\..\..\..\wxWidgets-3.1.3\lib\gcc_dll\libwxjpeg.a ..\..\..\..\..\wxWidgets-3.1.3\lib\gcc_dll\libwxmsw31u_adv.a ..\..\..\..\..\wxWidgets-3.1.3\lib\gcc_dll\libwxmsw31u_aui.a ..\..\..\..\..\wxWidgets-3.1.3\lib\gcc_dll\libwxmsw31u_core.a ..\..\..\..\..\wxWidgets-3.1.3\lib\gcc_dll\libwxmsw31u_gl.a ..\..\..\..\..\wxWidgets-3.1.3\lib\gcc_dll\libwxmsw31u_html.a ..\..\..\..\..\wxWidgets-3.1.3\lib\gcc_dll\libwxmsw31u_media.a ..\..\..\..\..\wxWidgets-3.1.3\lib\gcc_dll\libwxmsw31u_propgrid.a ..\..\..\..\..\wxWidgets-3.1.3\lib\gcc_dll\libwxmsw31u_ribbon.a ..\..\..\..\..\wxWidgets-3.1.3\lib\gcc_dll\libwxmsw31u_richtext.a ..\..\..\..\..\wxWidgets-3.1.3\lib\gcc_dll\libwxmsw31u_stc.a ..\..\..\..\..\wxWidgets-3.1.3\lib\gcc_dll\libwxmsw31u_webview.a ..\..\..\..\..\wxWidgets-3.1.3\lib\gcc_dll\libwxmsw31u_xrc.a ..\..\..\..\..\wxWidgets-3.1.3\lib\gcc_dll\libwxpng.a ..\..\..\..\..\wxWidgets-3.1.3\lib\gcc_dll\libwxregex.a ..\..\..\..\..\wxWidgets-3.1.3\lib\gcc_dll\libwxregexu.a ..\..\..\..\..\wxWidgets-3.1.3\lib\gcc_dll\libwxscintilla.a ..\..\..\..\..\wxWidgets-3.1.3\lib\gcc_dll\libwxtiff.a ..\..\..\..\..\wxWidgets-3.1.3\lib\gcc_dll\libwxzlib.a ..\..\..\..\..\MinGW\lib\libmysql.a ..\..\..\..\..\mysql++-3.2.5\vc2008\x64\Release\mysqlpp.lib ..\..\..\..\..\mysql++-3.2.5\vc2008\x64\Release\mysqlpp_excommon.lib ..\..\..\..\..\mysql++-3.2.5\vc2008\x64\Release\mysqlpp_ssqls2parse.lib "..\..\..\..\..\Program Files\MySQL\MySQL Connector C 6.1\lib\libmysql.lib"
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: obj\Debug\Page1Scrolled.o: in function `ZN13Page1ScrolledC2EP8wxWindowP9PumpFrameiRK7wxPointRK6wxSize':
C:/Users/39328/Documents/Codeblocks/Pump/Page1Scrolled.cpp:241: undefined reference to `_imp___ZN7mysqlpp10ConnectionC1Eb'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:/Users/39328/Documents/Codeblocks/Pump/Page1Scrolled.cpp:242: undefined reference to `_imp___ZN7mysqlpp10Connection7connectEPKcS2_S2_S2_j'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:/Users/39328/Documents/Codeblocks/Pump/Page1Scrolled.cpp:245: undefined reference to `_imp___ZN7mysqlpp10Connection5queryEPKc'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:/Users/39328/Documents/Codeblocks/Pump/Page1Scrolled.cpp:246: undefined reference to `_imp___ZN7mysqlpp5Query5storeEv'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:/Users/39328/Documents/Codeblocks/Pump/Page1Scrolled.cpp:260: undefined reference to `_imp___ZNK7mysqlpp3RowixEPKc'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:/Users/39328/Documents/Codeblocks/Pump/Page1Scrolled.cpp:260: undefined reference to `_imp___ZN7mysqlpplsERSoRKNS_6StringE'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:/Users/39328/Documents/Codeblocks/Pump/Page1Scrolled.cpp:261: undefined reference to `_imp___ZNK7mysqlpp3RowixEPKc'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:/Users/39328/Documents/Codeblocks/Pump/Page1Scrolled.cpp:261: undefined reference to `_imp___ZN7mysqlpplsERSoRKNS_6StringE'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:/Users/39328/Documents/Codeblocks/Pump/Page1Scrolled.cpp:262: undefined reference to `_imp___ZNK7mysqlpp3RowixEPKc'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:/Users/39328/Documents/Codeblocks/Pump/Page1Scrolled.cpp:262: undefined reference to `_imp___ZN7mysqlpplsERSoRKNS_6StringE'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:/Users/39328/Documents/Codeblocks/Pump/Page1Scrolled.cpp:263: undefined reference to `_imp___ZNK7mysqlpp3RowixEPKc'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:/Users/39328/Documents/Codeblocks/Pump/Page1Scrolled.cpp:263: undefined reference to `_imp___ZN7mysqlpplsERSoRKNS_6StringE'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:/Users/39328/Documents/Codeblocks/Pump/Page1Scrolled.cpp:264: undefined reference to `_imp___ZNK7mysqlpp3RowixEPKc'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:/Users/39328/Documents/Codeblocks/Pump/Page1Scrolled.cpp:264: undefined reference to `_imp___ZN7mysqlpplsERSoRKNS_6StringE'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:/Users/39328/Documents/Codeblocks/Pump/Page1Scrolled.cpp:269: undefined reference to `_imp___ZNK7mysqlpp5Query5errorEv'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:/Users/39328/Documents/Codeblocks/Pump/Page1Scrolled.cpp:274: undefined reference to `_imp___ZNK7mysqlpp10Connection5errorEv'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:/Users/39328/Documents/Codeblocks/Pump/Page1Scrolled.cpp:241: undefined reference to `_imp___ZN7mysqlpp10ConnectionD1Ev'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: C:/Users/39328/Documents/Codeblocks/Pump/Page1Scrolled.cpp:241: undefined reference to `_imp___ZN7mysqlpp10ConnectionD1Ev'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: obj\Debug\Page1Scrolled.o: in function `ZN7mysqlpp18OptionalExceptionsD2Ev':
c:/mysql++-3.2.5/lib/noexceptions.h:83: undefined reference to `_imp___ZTVN7mysqlpp18OptionalExceptionsE'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: obj\Debug\Page1Scrolled.o: in function `ZN7mysqlpp18OptionalExceptionsD1Ev':
c:/mysql++-3.2.5/lib/noexceptions.h:83: undefined reference to `_imp___ZTVN7mysqlpp18OptionalExceptionsE'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: obj\Debug\Page1Scrolled.o: in function `ZN7mysqlpp10ResultBaseD2Ev':
c:/mysql++-3.2.5/lib/result.h:114: undefined reference to `_imp___ZTVN7mysqlpp10ResultBaseE'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: obj\Debug\Page1Scrolled.o: in function `ZN7mysqlpp10ResultBaseD1Ev':
c:/mysql++-3.2.5/lib/result.h:114: undefined reference to `_imp___ZTVN7mysqlpp10ResultBaseE'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: obj\Debug\Page1Scrolled.o: in function `ZN7mysqlpp16StoreQueryResultD1Ev':
c:/mysql++-3.2.5/lib/result.h:244: undefined reference to `_imp___ZTVN7mysqlpp16StoreQueryResultE'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: obj\Debug\Page1Scrolled.o: in function `ZN7mysqlpp5QueryD1Ev':
c:/mysql++-3.2.5/lib/query.h:121: undefined reference to `_imp___ZTVN7mysqlpp5QueryE'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: c:/mysql++-3.2.5/lib/query.h:121: undefined reference to `_imp___ZTVN7mysqlpp5QueryE'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: c:/mysql++-3.2.5/lib/query.h:121: undefined reference to `_imp___ZTVN7mysqlpp5QueryE'
c:/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: c:/mysql++-3.2.5/lib/query.h:121: undefined reference to `_imp___ZTTN7mysqlpp5QueryE'
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 0 second(s))
28 error(s), 0 warning(s) (0 minute(s), 0 second(s))
(6) By Warren Young (tangent) on 2020-07-07 05:04:51 in reply to 5.1 [link] [source]
I thought that I could compile the code by using mingw and the compiled libraries, but I was wrong.
You cannot use a library compiled by one C++ compiler with any sufficiently different C++ compiler.