[odb-users] Linker issues during compilation with odb-mysqlLib.

Jannis Röglin jannis.roeglin at psi-technics.com
Tue Feb 22 10:25:44 EST 2022


Hello,

I built the new version ODB 2.5.0-b.21 with build2. I am trying to get the "Hello Person" program to work without any extras- main.cpp, person.hxx, person-odb.hxx, person-odb.ixx, person-odb.cxx.
But I get when compiling linker error that external symbols cannot be resolved.

Following my linker input:
C:\dependencies\odb\debug-64\lib\odb.lib;
C:\dependencies\odb\debug-64\lib\odb-mysql.lib;

We use Visual Studio 2019.

Do you have any ideas to solve this issue?

Additional question:
We are using c++20 for our project. Is it possible to create the .hxx file with c++17 and use it for a c++20 project?

Following is the linker error output:
1>------ Neues Erstellen gestartet: Projekt: Test_ODB, Konfiguration: Debug x64 ------
1>compiling C:\Git_repo\Test_ODB\Test_ODB\person.hxx
1>person-odb.cxx
1>Test_ODB.cpp
1>C:\Git_repo\Test_ODB\Test_ODB\person.hxx(9,9): warning C4068: Unbekanntes Pragma "db".
1>C:\Git_repo\Test_ODB\Test_ODB\person.hxx(31,10): warning C4068: Unbekanntes Pragma "db".
1>Code wird generiert...
1>odb-mysql.lib(statement.lib.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "mysql_stmt_prepare" in Funktion ""private: void __cdecl odb::mysql::statement::init(unsigned __int64,enum odb::mysql::statement_kind,class odb::mysql::binding const *,bool)" (?init at statement@mysql at odb@@AEAAX_KW4statement_kind at 23@PEBVbinding at 23@_N at Z)".
1>odb-mysql.lib(statement.lib.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "mysql_stmt_execute" in Funktion ""public: void __cdecl odb::mysql::select_statement::execute(void)" (?execute at select_statement@mysql at odb@@QEAAXXZ)".
1>odb-mysql.lib(statement.lib.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "mysql_stmt_fetch" in Funktion ""public: enum odb::mysql::select_statement::result __cdecl odb::mysql::select_statement::fetch(bool)" (?fetch at select_statement@mysql at odb@@QEAA?AW4result at 123@_N at Z)".
1>odb-mysql.lib(statement.lib.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "mysql_stmt_fetch_column" in Funktion ""public: void __cdecl odb::mysql::select_statement::refetch(void)" (?refetch at select_statement@mysql at odb@@QEAAXXZ)".
1>odb-mysql.lib(statement.lib.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "mysql_stmt_store_result" in Funktion ""public: void __cdecl odb::mysql::select_statement::cache(void)" (?cache at select_statement@mysql at odb@@QEAAXXZ)".
1>odb-mysql.lib(statement.lib.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "mysql_stmt_bind_param" in Funktion ""public: void __cdecl odb::mysql::select_statement::execute(void)" (?execute at select_statement@mysql at odb@@QEAAXXZ)".
1>odb-mysql.lib(statement.lib.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "mysql_stmt_bind_result" in Funktion ""public: enum odb::mysql::select_statement::result __cdecl odb::mysql::select_statement::fetch(bool)" (?fetch at select_statement@mysql at odb@@QEAA?AW4result at 123@_N at Z)".
1>odb-mysql.lib(statement.lib.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "mysql_stmt_close" in Funktion ""public: static void __cdecl odb::mysql::handle_traits<struct MYSQL_STMT>::release(struct MYSQL_STMT *)" (?release@?$handle_traits at UMYSQL_STMT@@@mysql at odb@@SAXPEAUMYSQL_STMT@@@Z)".
1>odb-mysql.lib(connection.lib.obj) : error LNK2001: Nicht aufgelöstes externes Symbol "mysql_stmt_close".
1>odb-mysql.lib(statement.lib.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "mysql_stmt_reset" in Funktion ""public: void __cdecl odb::mysql::select_statement::execute(void)" (?execute at select_statement@mysql at odb@@QEAAXXZ)".
1>odb-mysql.lib(statement.lib.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "mysql_stmt_free_result" in Funktion ""public: void __cdecl odb::mysql::select_statement::free_result(void)" (?free_result at select_statement@mysql at odb@@QEAAXXZ)".
1>odb-mysql.lib(statement.lib.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "mysql_stmt_errno" in Funktion ""public: bool __cdecl odb::mysql::insert_statement::execute(void)" (?execute at insert_statement@mysql at odb@@QEAA_NXZ)".
1>odb-mysql.lib(error.lib.obj) : error LNK2001: Nicht aufgelöstes externes Symbol "mysql_stmt_errno".
1>odb-mysql.lib(statement.lib.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "mysql_stmt_data_seek" in Funktion ""public: enum odb::mysql::select_statement::result __cdecl odb::mysql::select_statement::fetch(bool)" (?fetch at select_statement@mysql at odb@@QEAA?AW4result at 123@_N at Z)".
1>odb-mysql.lib(statement.lib.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "mysql_stmt_num_rows" in Funktion ""public: void __cdecl odb::mysql::select_statement::cache(void)" (?cache at select_statement@mysql at odb@@QEAAXXZ)".
1>odb-mysql.lib(statement.lib.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "mysql_stmt_affected_rows" in Funktion ""public: unsigned __int64 __cdecl odb::mysql::update_statement::execute(void)" (?execute at update_statement@mysql at odb@@QEAA_KXZ)".
1>odb-mysql.lib(statement.lib.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "mysql_stmt_insert_id" in Funktion ""public: bool __cdecl odb::mysql::insert_statement::execute(void)" (?execute at insert_statement@mysql at odb@@QEAA_NXZ)".
1>odb-mysql.lib(statement.lib.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "mysql_stmt_field_count" in Funktion ""public: enum odb::mysql::select_statement::result __cdecl odb::mysql::select_statement::fetch(bool)" (?fetch at select_statement@mysql at odb@@QEAA?AW4result at 123@_N at Z)".
1>odb-mysql.lib(statement.lib.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "mysql_stmt_next_result" in Funktion ""public: void __cdecl odb::mysql::select_statement::free_result(void)" (?free_result at select_statement@mysql at odb@@QEAAXXZ)".
1>odb-mysql.lib(connection.lib.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "mysql_num_rows" in Funktion ""public: virtual unsigned __int64 __cdecl odb::mysql::connection::execute(char const *,unsigned __int64)" (?execute at connection@mysql at odb@@UEAA_KPEBD_K at Z)".
1>odb-mysql.lib(connection.lib.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "mysql_field_count" in Funktion ""public: virtual unsigned __int64 __cdecl odb::mysql::connection::execute(char const *,unsigned __int64)" (?execute at connection@mysql at odb@@UEAA_KPEBD_K at Z)".
1>odb-mysql.lib(connection.lib.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "mysql_affected_rows" in Funktion ""public: virtual unsigned __int64 __cdecl odb::mysql::connection::execute(char const *,unsigned __int64)" (?execute at connection@mysql at odb@@UEAA_KPEBD_K at Z)".
1>odb-mysql.lib(connection.lib.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "mysql_errno" in Funktion ""public: __cdecl odb::mysql::connection::connection(class odb::mysql::connection_factory &)" (??0connection at mysql@odb@@QEAA at AEAVconnection_factory@12@@Z)".
1>odb-mysql.lib(error.lib.obj) : error LNK2001: Nicht aufgelöstes externes Symbol "mysql_errno".
1>odb-mysql.lib(connection.lib.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "mysql_error" in Funktion ""public: __cdecl odb::mysql::connection::connection(class odb::mysql::connection_factory &)" (??0connection at mysql@odb@@QEAA at AEAVconnection_factory@12@@Z)".
1>odb-mysql.lib(error.lib.obj) : error LNK2001: Nicht aufgelöstes externes Symbol "mysql_error".
1>odb-mysql.lib(connection.lib.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "mysql_sqlstate" in Funktion ""public: __cdecl odb::mysql::connection::connection(class odb::mysql::connection_factory &)" (??0connection at mysql@odb@@QEAA at AEAVconnection_factory@12@@Z)".
1>odb-mysql.lib(error.lib.obj) : error LNK2001: Nicht aufgelöstes externes Symbol "mysql_sqlstate".
1>odb-mysql.lib(connection.lib.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "mysql_init" in Funktion ""public: __cdecl odb::mysql::connection::connection(class odb::mysql::connection_factory &)" (??0connection at mysql@odb@@QEAA at AEAVconnection_factory@12@@Z)".
1>odb-mysql.lib(connection.lib.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "mysql_real_connect" in Funktion ""public: __cdecl odb::mysql::connection::connection(class odb::mysql::connection_factory &)" (??0connection at mysql@odb@@QEAA at AEAVconnection_factory@12@@Z)".
1>odb-mysql.lib(connection.lib.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "mysql_real_query" in Funktion ""public: virtual unsigned __int64 __cdecl odb::mysql::connection::execute(char const *,unsigned __int64)" (?execute at connection@mysql at odb@@UEAA_KPEBD_K at Z)".
1>odb-mysql.lib(transaction-impl.lib.obj) : error LNK2001: Nicht aufgelöstes externes Symbol "mysql_real_query".
1>odb-mysql.lib(connection.lib.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "mysql_store_result" in Funktion ""public: virtual unsigned __int64 __cdecl odb::mysql::connection::execute(char const *,unsigned __int64)" (?execute at connection@mysql at odb@@UEAA_KPEBD_K at Z)".
1>odb-mysql.lib(connection.lib.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "mysql_ping" in Funktion ""public: bool __cdecl odb::mysql::connection::ping(void)" (?ping at connection@mysql at odb@@QEAA_NXZ)".
1>odb-mysql.lib(connection.lib.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "mysql_options" in Funktion ""public: __cdecl odb::mysql::connection::connection(class odb::mysql::connection_factory &)" (??0connection at mysql@odb@@QEAA at AEAVconnection_factory@12@@Z)".
1>odb-mysql.lib(connection.lib.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "mysql_free_result" in Funktion ""public: virtual unsigned __int64 __cdecl odb::mysql::connection::execute(char const *,unsigned __int64)" (?execute at connection@mysql at odb@@UEAA_KPEBD_K at Z)".
1>odb-mysql.lib(connection.lib.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "mysql_stmt_init" in Funktion ""public: struct MYSQL_STMT * __cdecl odb::mysql::connection::alloc_stmt_handle(void)" (?alloc_stmt_handle at connection@mysql at odb@@QEAAPEAUMYSQL_STMT@@XZ)".
1>odb-mysql.lib(connection.lib.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "mysql_close" in Funktion ""public: static void __cdecl odb::mysql::handle_traits<struct MYSQL>::release(struct MYSQL *)" (?release@?$handle_traits at UMYSQL@@@mysql at odb@@SAXPEAUMYSQL@@@Z)".
1>odb-mysql.lib(error.lib.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "mysql_stmt_error" in Funktion ""void __cdecl odb::mysql::translate_error(class odb::mysql::connection &,struct MYSQL_STMT *)" (?translate_error at mysql@odb@@YAXAEAVconnection at 12@PEAUMYSQL_STMT@@@Z)".
1>odb-mysql.lib(error.lib.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "mysql_stmt_sqlstate" in Funktion ""void __cdecl odb::mysql::translate_error(class odb::mysql::connection &,struct MYSQL_STMT *)" (?translate_error at mysql@odb@@YAXAEAVconnection at 12@PEAUMYSQL_STMT@@@Z)".
1>odb-mysql.lib(connection-factory.lib.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "mysql_server_init" in Funktion ""public: __cdecl odb::mysql::`anonymous namespace'::mysql_process_init::mysql_process_init(void)" (??0mysql_process_init@?A0xb31c5a84 at mysql@odb@@QEAA at XZ)".
1>odb-mysql.lib(connection-factory.lib.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "mysql_server_end" in Funktion ""public: __cdecl odb::mysql::`anonymous namespace'::mysql_process_init::~mysql_process_init(void)" (??1mysql_process_init@?A0xb31c5a84 at mysql@odb@@QEAA at XZ)".
1>odb-mysql.lib(connection-factory.lib.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "mysql_thread_init" in Funktion ""public: __cdecl odb::mysql::`anonymous namespace'::mysql_thread_init::mysql_thread_init(void)" (??0mysql_thread_init@?A0xb31c5a84 at mysql@odb@@QEAA at XZ)".
1>odb-mysql.lib(connection-factory.lib.obj) : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "mysql_thread_end" in Funktion ""public: __cdecl odb::mysql::`anonymous namespace'::mysql_thread_init::~mysql_thread_init(void)" (??1mysql_thread_init@?A0xb31c5a84 at mysql@odb@@QEAA at XZ)".
1>C:\Git_repo\Test_ODB\Test_ODB\x64\Debug\Test_ODB.exe : fatal error LNK1120: 38 nicht aufgelöste Externe
1>Die Erstellung des Projekts "Test_ODB.vcxproj" ist abgeschlossen -- FEHLER.
========== Alles neu erstellen: 0 erfolgreich, 1 fehlerhaft, 0 übersprungen ==========


Best regards

Jannis Röglin

PSI Technics GmbH
Applikations- & Entwicklungsingenieur / Application & development engineer


More information about the odb-users mailing list