MySQL C ++连接器未解析的依赖关系(VS 2015)

时间:2017-02-01 22:33:46

标签: c++ mysql visual-studio cmake mysql-connector

我正在尝试在Windows / Visual Studio 2015上编译MySQL Connector C ++。 我根据official instructions使用CMake生成了项目文件,工作正常。现在,当我尝试编译解决方案时,我收到以下链接器错误:

5>mysqlcppconn-static.lib(mysql_client_api.obj) : error LNK2019: unresolved external symbol _mysql_server_init@12 referenced in function "public: virtual int __thiscall sql::mysql::NativeAPI::LibmysqlStaticProxy::library_init(int,char * *,char * *)" (?library_init@LibmysqlStaticProxy@NativeAPI@mysql@sql@@UAEHHPAPAD0@Z)
5>mysqlcppconn-static.lib(mysql_client_api.obj) : error LNK2019: unresolved external symbol _mysql_server_end@0 referenced in function "public: virtual void __thiscall sql::mysql::NativeAPI::LibmysqlStaticProxy::library_end(void)" (?library_end@LibmysqlStaticProxy@NativeAPI@mysql@sql@@UAEXXZ)
5>mysqlcppconn-static.lib(mysql_client_api.obj) : error LNK2019: unresolved external symbol _mysql_thread_init@0 referenced in function "public: virtual void __thiscall sql::mysql::NativeAPI::LibmysqlStaticProxy::thread_init(void)" (?thread_init@LibmysqlStaticProxy@NativeAPI@mysql@sql@@UAEXXZ)
5>mysqlcppconn-static.lib(mysql_client_api.obj) : error LNK2019: unresolved external symbol _mysql_thread_end@0 referenced in function "public: virtual void __thiscall sql::mysql::NativeAPI::LibmysqlStaticProxy::thread_end(void)" (?thread_end@LibmysqlStaticProxy@NativeAPI@mysql@sql@@UAEXXZ)
5>mysqlcppconn-static.lib(mysql_client_api.obj) : error LNK2019: unresolved external symbol _mysql_num_rows@4 referenced in function "public: virtual unsigned __int64 __thiscall sql::mysql::NativeAPI::LibmysqlStaticProxy::num_rows(struct st_mysql_res *)" (?num_rows@LibmysqlStaticProxy@NativeAPI@mysql@sql@@UAE_KPAUst_mysql_res@@@Z)
5>mysqlcppconn-static.lib(mysql_client_api.obj) : error LNK2019: unresolved external symbol _mysql_num_fields@4 referenced in function "public: virtual unsigned int __thiscall sql::mysql::NativeAPI::LibmysqlStaticProxy::num_fields(struct st_mysql_res *)" (?num_fields@LibmysqlStaticProxy@NativeAPI@mysql@sql@@UAEIPAUst_mysql_res@@@Z)
5>mysqlcppconn-static.lib(mysql_client_api.obj) : error LNK2019: unresolved external symbol _mysql_fetch_field_direct@8 referenced in function "public: virtual struct st_mysql_field * __thiscall sql::mysql::NativeAPI::LibmysqlStaticProxy::fetch_field_direct(struct st_mysql_res *,unsigned int)" (?fetch_field_direct@LibmysqlStaticProxy@NativeAPI@mysql@sql@@UAEPAUst_mysql_field@@PAUst_mysql_res@@I@Z)
5>mysqlcppconn-static.lib(mysql_client_api.obj) : error LNK2019: unresolved external symbol _mysql_field_count@4 referenced in function "public: virtual unsigned int __thiscall sql::mysql::NativeAPI::LibmysqlStaticProxy::field_count(struct st_mysql *)" (?field_count@LibmysqlStaticProxy@NativeAPI@mysql@sql@@UAEIPAUst_mysql@@@Z)
5>mysqlcppconn-static.lib(mysql_client_api.obj) : error LNK2019: unresolved external symbol _mysql_affected_rows@4 referenced in function "public: virtual unsigned __int64 __thiscall sql::mysql::NativeAPI::LibmysqlStaticProxy::affected_rows(struct st_mysql *)" (?affected_rows@LibmysqlStaticProxy@NativeAPI@mysql@sql@@UAE_KPAUst_mysql@@@Z)
5>mysqlcppconn-static.lib(mysql_client_api.obj) : error LNK2019: unresolved external symbol _mysql_errno@4 referenced in function "public: virtual unsigned int __thiscall sql::mysql::NativeAPI::LibmysqlStaticProxy::mysql_errno(struct st_mysql *)" (?mysql_errno@LibmysqlStaticProxy@NativeAPI@mysql@sql@@UAEIPAUst_mysql@@@Z)
5>mysqlcppconn-static.lib(mysql_client_api.obj) : error LNK2019: unresolved external symbol _mysql_error@4 referenced in function "public: virtual char const * __thiscall sql::mysql::NativeAPI::LibmysqlStaticProxy::error(struct st_mysql *)" (?error@LibmysqlStaticProxy@NativeAPI@mysql@sql@@UAEPBDPAUst_mysql@@@Z)
5>mysqlcppconn-static.lib(mysql_client_api.obj) : error LNK2019: unresolved external symbol _mysql_sqlstate@4 referenced in function "public: virtual char const * __thiscall sql::mysql::NativeAPI::LibmysqlStaticProxy::sqlstate(struct st_mysql *)" (?sqlstate@LibmysqlStaticProxy@NativeAPI@mysql@sql@@UAEPBDPAUst_mysql@@@Z)
5>mysqlcppconn-static.lib(mysql_client_api.obj) : error LNK2019: unresolved external symbol _mysql_warning_count@4 referenced in function "public: virtual unsigned int __thiscall sql::mysql::NativeAPI::LibmysqlStaticProxy::warning_count(struct st_mysql *)" (?warning_count@LibmysqlStaticProxy@NativeAPI@mysql@sql@@UAEIPAUst_mysql@@@Z)
5>mysqlcppconn-static.lib(mysql_client_api.obj) : error LNK2019: unresolved external symbol _mysql_info@4 referenced in function "public: virtual char const * __thiscall sql::mysql::NativeAPI::LibmysqlStaticProxy::info(struct st_mysql *)" (?info@LibmysqlStaticProxy@NativeAPI@mysql@sql@@UAEPBDPAUst_mysql@@@Z)
5>mysqlcppconn-static.lib(mysql_client_api.obj) : error LNK2019: unresolved external symbol _mysql_init@4 referenced in function "public: virtual struct st_mysql * __thiscall sql::mysql::NativeAPI::LibmysqlStaticProxy::init(struct st_mysql *)" (?init@LibmysqlStaticProxy@NativeAPI@mysql@sql@@UAEPAUst_mysql@@PAU5@@Z)
5>mysqlcppconn-static.lib(mysql_client_api.obj) : error LNK2019: unresolved external symbol _mysql_ssl_set@24 referenced in function "public: virtual char __thiscall sql::mysql::NativeAPI::LibmysqlStaticProxy::ssl_set(struct st_mysql *,char const *,char const *,char const *,char const *,char const *)" (?ssl_set@LibmysqlStaticProxy@NativeAPI@mysql@sql@@UAEDPAUst_mysql@@PBD1111@Z)
5>mysqlcppconn-static.lib(mysql_client_api.obj) : error LNK2019: unresolved external symbol _mysql_real_connect@32 referenced in function "public: virtual struct st_mysql * __thiscall sql::mysql::NativeAPI::LibmysqlStaticProxy::real_connect(struct st_mysql *,char const *,char const *,char const *,char const *,unsigned int,char const *,unsigned long)" (?real_connect@LibmysqlStaticProxy@NativeAPI@mysql@sql@@UAEPAUst_mysql@@PAU5@PBD111I1K@Z)
5>mysqlcppconn-static.lib(mysql_client_api.obj) : error LNK2019: unresolved external symbol _mysql_query@8 referenced in function "public: virtual int __thiscall sql::mysql::NativeAPI::LibmysqlStaticProxy::query(struct st_mysql *,char const *)" (?query@LibmysqlStaticProxy@NativeAPI@mysql@sql@@UAEHPAUst_mysql@@PBD@Z)
5>mysqlcppconn-static.lib(mysql_client_api.obj) : error LNK2019: unresolved external symbol _mysql_real_query@12 referenced in function "public: virtual int __thiscall sql::mysql::NativeAPI::LibmysqlStaticProxy::real_query(struct st_mysql *,char const *,unsigned long)" (?real_query@LibmysqlStaticProxy@NativeAPI@mysql@sql@@UAEHPAUst_mysql@@PBDK@Z)
5>mysqlcppconn-static.lib(mysql_client_api.obj) : error LNK2019: unresolved external symbol _mysql_store_result@4 referenced in function "public: virtual struct st_mysql_res * __thiscall sql::mysql::NativeAPI::LibmysqlStaticProxy::store_result(struct st_mysql *)" (?store_result@LibmysqlStaticProxy@NativeAPI@mysql@sql@@UAEPAUst_mysql_res@@PAUst_mysql@@@Z)
5>mysqlcppconn-static.lib(mysql_client_api.obj) : error LNK2019: unresolved external symbol _mysql_use_result@4 referenced in function "public: virtual struct st_mysql_res * __thiscall sql::mysql::NativeAPI::LibmysqlStaticProxy::use_result(struct st_mysql *)" (?use_result@LibmysqlStaticProxy@NativeAPI@mysql@sql@@UAEPAUst_mysql_res@@PAUst_mysql@@@Z)
5>mysqlcppconn-static.lib(mysql_client_api.obj) : error LNK2019: unresolved external symbol _mysql_get_character_set_info@8 referenced in function "public: virtual void __thiscall sql::mysql::NativeAPI::LibmysqlStaticProxy::get_character_set_info(struct st_mysql *,void *)" (?get_character_set_info@LibmysqlStaticProxy@NativeAPI@mysql@sql@@UAEXPAUst_mysql@@PAX@Z)
5>mysqlcppconn-static.lib(mysql_client_api.obj) : error LNK2019: unresolved external symbol _mysql_ping@4 referenced in function "public: virtual int __thiscall sql::mysql::NativeAPI::LibmysqlStaticProxy::ping(struct st_mysql *)" (?ping@LibmysqlStaticProxy@NativeAPI@mysql@sql@@UAEHPAUst_mysql@@@Z)
5>mysqlcppconn-static.lib(mysql_client_api.obj) : error LNK2019: unresolved external symbol _mysql_get_server_info@4 referenced in function "public: virtual char const * __thiscall sql::mysql::NativeAPI::LibmysqlStaticProxy::get_server_info(struct st_mysql *)" (?get_server_info@LibmysqlStaticProxy@NativeAPI@mysql@sql@@UAEPBDPAUst_mysql@@@Z)
5>mysqlcppconn-static.lib(mysql_client_api.obj) : error LNK2019: unresolved external symbol _mysql_get_client_version@0 referenced in function "public: virtual unsigned long __thiscall sql::mysql::NativeAPI::LibmysqlStaticProxy::get_client_version(void)" (?get_client_version@LibmysqlStaticProxy@NativeAPI@mysql@sql@@UAEKXZ)
5>mysqlcppconn-static.lib(mysql_client_api.obj) : error LNK2019: unresolved external symbol _mysql_get_server_version@4 referenced in function "public: virtual unsigned long __thiscall sql::mysql::NativeAPI::LibmysqlStaticProxy::get_server_version(struct st_mysql *)" (?get_server_version@LibmysqlStaticProxy@NativeAPI@mysql@sql@@UAEKPAUst_mysql@@@Z)
5>mysqlcppconn-static.lib(mysql_client_api.obj) : error LNK2019: unresolved external symbol _mysql_options@12 referenced in function "public: virtual int __thiscall sql::mysql::NativeAPI::LibmysqlStaticProxy::options(struct st_mysql *,enum mysql_option,void const *)" (?options@LibmysqlStaticProxy@NativeAPI@mysql@sql@@UAEHPAUst_mysql@@W4mysql_option@@PBX@Z)
5>mysqlcppconn-static.lib(mysql_client_api.obj) : error LNK2019: unresolved external symbol _mysql_options4@16 referenced in function "public: virtual int __thiscall sql::mysql::NativeAPI::LibmysqlStaticProxy::options(struct st_mysql *,enum mysql_option,void const *,void const *)" (?options@LibmysqlStaticProxy@NativeAPI@mysql@sql@@UAEHPAUst_mysql@@W4mysql_option@@PBX2@Z)
5>mysqlcppconn-static.lib(mysql_client_api.obj) : error LNK2019: unresolved external symbol _mysql_get_option@12 referenced in function "public: virtual int __thiscall sql::mysql::NativeAPI::LibmysqlStaticProxy::get_option(struct st_mysql *,enum mysql_option,void const *)" (?get_option@LibmysqlStaticProxy@NativeAPI@mysql@sql@@UAEHPAUst_mysql@@W4mysql_option@@PBX@Z)
5>mysqlcppconn-static.lib(mysql_client_api.obj) : error LNK2019: unresolved external symbol _mysql_free_result@4 referenced in function "public: virtual void __thiscall sql::mysql::NativeAPI::LibmysqlStaticProxy::free_result(struct st_mysql_res *)" (?free_result@LibmysqlStaticProxy@NativeAPI@mysql@sql@@UAEXPAUst_mysql_res@@@Z)
5>mysqlcppconn-static.lib(mysql_client_api.obj) : error LNK2019: unresolved external symbol _mysql_data_seek@12 referenced in function "public: virtual void __thiscall sql::mysql::NativeAPI::LibmysqlStaticProxy::data_seek(struct st_mysql_res *,unsigned __int64)" (?data_seek@LibmysqlStaticProxy@NativeAPI@mysql@sql@@UAEXPAUst_mysql_res@@_K@Z)
5>mysqlcppconn-static.lib(mysql_client_api.obj) : error LNK2019: unresolved external symbol _mysql_fetch_row@4 referenced in function "public: virtual char * * __thiscall sql::mysql::NativeAPI::LibmysqlStaticProxy::fetch_row(struct st_mysql_res *)" (?fetch_row@LibmysqlStaticProxy@NativeAPI@mysql@sql@@UAEPAPADPAUst_mysql_res@@@Z)
5>mysqlcppconn-static.lib(mysql_client_api.obj) : error LNK2019: unresolved external symbol _mysql_fetch_lengths@4 referenced in function "public: virtual unsigned long * __thiscall sql::mysql::NativeAPI::LibmysqlStaticProxy::fetch_lengths(struct st_mysql_res *)" (?fetch_lengths@LibmysqlStaticProxy@NativeAPI@mysql@sql@@UAEPAKPAUst_mysql_res@@@Z)
5>mysqlcppconn-static.lib(mysql_client_api.obj) : error LNK2019: unresolved external symbol _mysql_fetch_field@4 referenced in function "public: virtual struct st_mysql_field * __thiscall sql::mysql::NativeAPI::LibmysqlStaticProxy::fetch_field(struct st_mysql_res *)" (?fetch_field@LibmysqlStaticProxy@NativeAPI@mysql@sql@@UAEPAUst_mysql_field@@PAUst_mysql_res@@@Z)
5>mysqlcppconn-static.lib(mysql_client_api.obj) : error LNK2019: unresolved external symbol _mysql_real_escape_string@16 referenced in function "public: virtual unsigned long __thiscall sql::mysql::NativeAPI::LibmysqlStaticProxy::real_escape_string(struct st_mysql *,char *,char const *,unsigned long)" (?real_escape_string@LibmysqlStaticProxy@NativeAPI@mysql@sql@@UAEKPAUst_mysql@@PADPBDK@Z)
5>mysqlcppconn-static.lib(mysql_client_api.obj) : error LNK2019: unresolved external symbol _mysql_debug@4 referenced in function "public: virtual void __thiscall sql::mysql::NativeAPI::LibmysqlStaticProxy::debug(char const *)" (?debug@LibmysqlStaticProxy@NativeAPI@mysql@sql@@UAEXPBD@Z)
5>mysqlcppconn-static.lib(mysql_client_api.obj) : error LNK2019: unresolved external symbol _mysql_stmt_init@4 referenced in function "public: virtual struct st_mysql_stmt * __thiscall sql::mysql::NativeAPI::LibmysqlStaticProxy::stmt_init(struct st_mysql *)" (?stmt_init@LibmysqlStaticProxy@NativeAPI@mysql@sql@@UAEPAUst_mysql_stmt@@PAUst_mysql@@@Z)
5>mysqlcppconn-static.lib(mysql_client_api.obj) : error LNK2019: unresolved external symbol _mysql_stmt_prepare@12 referenced in function "public: virtual int __thiscall sql::mysql::NativeAPI::LibmysqlStaticProxy::stmt_prepare(struct st_mysql_stmt *,char const *,unsigned long)" (?stmt_prepare@LibmysqlStaticProxy@NativeAPI@mysql@sql@@UAEHPAUst_mysql_stmt@@PBDK@Z)
5>mysqlcppconn-static.lib(mysql_client_api.obj) : error LNK2019: unresolved external symbol _mysql_stmt_execute@4 referenced in function "public: virtual int __thiscall sql::mysql::NativeAPI::LibmysqlStaticProxy::stmt_execute(struct st_mysql_stmt *)" (?stmt_execute@LibmysqlStaticProxy@NativeAPI@mysql@sql@@UAEHPAUst_mysql_stmt@@@Z)
5>mysqlcppconn-static.lib(mysql_client_api.obj) : error LNK2019: unresolved external symbol _mysql_stmt_fetch@4 referenced in function "public: virtual int __thiscall sql::mysql::NativeAPI::LibmysqlStaticProxy::stmt_fetch(struct st_mysql_stmt *)" (?stmt_fetch@LibmysqlStaticProxy@NativeAPI@mysql@sql@@UAEHPAUst_mysql_stmt@@@Z)
5>mysqlcppconn-static.lib(mysql_client_api.obj) : error LNK2019: unresolved external symbol _mysql_stmt_store_result@4 referenced in function "public: virtual int __thiscall sql::mysql::NativeAPI::LibmysqlStaticProxy::stmt_store_result(struct st_mysql_stmt *)" (?stmt_store_result@LibmysqlStaticProxy@NativeAPI@mysql@sql@@UAEHPAUst_mysql_stmt@@@Z)
5>mysqlcppconn-static.lib(mysql_client_api.obj) : error LNK2019: unresolved external symbol _mysql_stmt_param_count@4 referenced in function "public: virtual unsigned long __thiscall sql::mysql::NativeAPI::LibmysqlStaticProxy::stmt_param_count(struct st_mysql_stmt *)" (?stmt_param_count@LibmysqlStaticProxy@NativeAPI@mysql@sql@@UAEKPAUst_mysql_stmt@@@Z)
5>mysqlcppconn-static.lib(mysql_client_api.obj) : error LNK2019: unresolved external symbol _mysql_stmt_attr_set@12 referenced in function "public: virtual char __thiscall sql::mysql::NativeAPI::LibmysqlStaticProxy::stmt_attr_set(struct st_mysql_stmt *,enum enum_stmt_attr_type,void const *)" (?stmt_attr_set@LibmysqlStaticProxy@NativeAPI@mysql@sql@@UAEDPAUst_mysql_stmt@@W4enum_stmt_attr_type@@PBX@Z)
5>mysqlcppconn-static.lib(mysql_client_api.obj) : error LNK2019: unresolved external symbol _mysql_stmt_bind_param@8 referenced in function "public: virtual char __thiscall sql::mysql::NativeAPI::LibmysqlStaticProxy::stmt_bind_param(struct st_mysql_stmt *,struct st_mysql_bind *)" (?stmt_bind_param@LibmysqlStaticProxy@NativeAPI@mysql@sql@@UAEDPAUst_mysql_stmt@@PAUst_mysql_bind@@@Z)
5>mysqlcppconn-static.lib(mysql_client_api.obj) : error LNK2019: unresolved external symbol _mysql_stmt_bind_result@8 referenced in function "public: virtual char __thiscall sql::mysql::NativeAPI::LibmysqlStaticProxy::stmt_bind_result(struct st_mysql_stmt *,struct st_mysql_bind *)" (?stmt_bind_result@LibmysqlStaticProxy@NativeAPI@mysql@sql@@UAEDPAUst_mysql_stmt@@PAUst_mysql_bind@@@Z)
5>mysqlcppconn-static.lib(mysql_client_api.obj) : error LNK2019: unresolved external symbol _mysql_stmt_close@4 referenced in function "public: virtual char __thiscall sql::mysql::NativeAPI::LibmysqlStaticProxy::stmt_close(struct st_mysql_stmt *)" (?stmt_close@LibmysqlStaticProxy@NativeAPI@mysql@sql@@UAEDPAUst_mysql_stmt@@@Z)
5>mysqlcppconn-static.lib(mysql_client_api.obj) : error LNK2019: unresolved external symbol _mysql_stmt_free_result@4 referenced in function "public: virtual bool __thiscall sql::mysql::NativeAPI::LibmysqlStaticProxy::stmt_free_result(struct st_mysql_stmt *)" (?stmt_free_result@LibmysqlStaticProxy@NativeAPI@mysql@sql@@UAE_NPAUst_mysql_stmt@@@Z)
5>mysqlcppconn-static.lib(mysql_client_api.obj) : error LNK2019: unresolved external symbol _mysql_stmt_send_long_data@16 referenced in function "public: virtual char __thiscall sql::mysql::NativeAPI::LibmysqlStaticProxy::stmt_send_long_data(struct st_mysql_stmt *,unsigned int,char const *,unsigned long)" (?stmt_send_long_data@LibmysqlStaticProxy@NativeAPI@mysql@sql@@UAEDPAUst_mysql_stmt@@IPBDK@Z)
5>mysqlcppconn-static.lib(mysql_client_api.obj) : error LNK2019: unresolved external symbol _mysql_stmt_result_metadata@4 referenced in function "public: virtual struct st_mysql_res * __thiscall sql::mysql::NativeAPI::LibmysqlStaticProxy::stmt_result_metadata(struct st_mysql_stmt *)" (?stmt_result_metadata@LibmysqlStaticProxy@NativeAPI@mysql@sql@@UAEPAUst_mysql_res@@PAUst_mysql_stmt@@@Z)
5>mysqlcppconn-static.lib(mysql_client_api.obj) : error LNK2019: unresolved external symbol _mysql_stmt_errno@4 referenced in function "public: virtual unsigned int __thiscall sql::mysql::NativeAPI::LibmysqlStaticProxy::stmt_errno(struct st_mysql_stmt *)" (?stmt_errno@LibmysqlStaticProxy@NativeAPI@mysql@sql@@UAEIPAUst_mysql_stmt@@@Z)
5>mysqlcppconn-static.lib(mysql_client_api.obj) : error LNK2019: unresolved external symbol _mysql_stmt_error@4 referenced in function "public: virtual char const * __thiscall sql::mysql::NativeAPI::LibmysqlStaticProxy::stmt_error(struct st_mysql_stmt *)" (?stmt_error@LibmysqlStaticProxy@NativeAPI@mysql@sql@@UAEPBDPAUst_mysql_stmt@@@Z)
5>mysqlcppconn-static.lib(mysql_client_api.obj) : error LNK2019: unresolved external symbol _mysql_stmt_sqlstate@4 referenced in function "public: virtual char const * __thiscall sql::mysql::NativeAPI::LibmysqlStaticProxy::stmt_sqlstate(struct st_mysql_stmt *)" (?stmt_sqlstate@LibmysqlStaticProxy@NativeAPI@mysql@sql@@UAEPBDPAUst_mysql_stmt@@@Z)
5>mysqlcppconn-static.lib(mysql_client_api.obj) : error LNK2019: unresolved external symbol _mysql_stmt_data_seek@12 referenced in function "public: virtual void __thiscall sql::mysql::NativeAPI::LibmysqlStaticProxy::stmt_data_seek(struct st_mysql_stmt *,unsigned __int64)" (?stmt_data_seek@LibmysqlStaticProxy@NativeAPI@mysql@sql@@UAEXPAUst_mysql_stmt@@_K@Z)
5>mysqlcppconn-static.lib(mysql_client_api.obj) : error LNK2019: unresolved external symbol _mysql_stmt_num_rows@4 referenced in function "public: virtual unsigned __int64 __thiscall sql::mysql::NativeAPI::LibmysqlStaticProxy::stmt_num_rows(struct st_mysql_stmt *)" (?stmt_num_rows@LibmysqlStaticProxy@NativeAPI@mysql@sql@@UAE_KPAUst_mysql_stmt@@@Z)
5>mysqlcppconn-static.lib(mysql_client_api.obj) : error LNK2019: unresolved external symbol _mysql_stmt_affected_rows@4 referenced in function "public: virtual unsigned __int64 __thiscall sql::mysql::NativeAPI::LibmysqlStaticProxy::stmt_affected_rows(struct st_mysql_stmt *)" (?stmt_affected_rows@LibmysqlStaticProxy@NativeAPI@mysql@sql@@UAE_KPAUst_mysql_stmt@@@Z)
5>mysqlcppconn-static.lib(mysql_client_api.obj) : error LNK2019: unresolved external symbol _mysql_stmt_field_count@4 referenced in function "public: virtual unsigned int __thiscall sql::mysql::NativeAPI::LibmysqlStaticProxy::stmt_field_count(struct st_mysql_stmt *)" (?stmt_field_count@LibmysqlStaticProxy@NativeAPI@mysql@sql@@UAEIPAUst_mysql_stmt@@@Z)
5>mysqlcppconn-static.lib(mysql_client_api.obj) : error LNK2019: unresolved external symbol _mysql_commit@4 referenced in function "public: virtual char __thiscall sql::mysql::NativeAPI::LibmysqlStaticProxy::commit(struct st_mysql *)" (?commit@LibmysqlStaticProxy@NativeAPI@mysql@sql@@UAEDPAUst_mysql@@@Z)
5>mysqlcppconn-static.lib(mysql_client_api.obj) : error LNK2019: unresolved external symbol _mysql_rollback@4 referenced in function "public: virtual char __thiscall sql::mysql::NativeAPI::LibmysqlStaticProxy::rollback(struct st_mysql *)" (?rollback@LibmysqlStaticProxy@NativeAPI@mysql@sql@@UAEDPAUst_mysql@@@Z)
5>mysqlcppconn-static.lib(mysql_client_api.obj) : error LNK2019: unresolved external symbol _mysql_autocommit@8 referenced in function "public: virtual char __thiscall sql::mysql::NativeAPI::LibmysqlStaticProxy::autocommit(struct st_mysql *,char)" (?autocommit@LibmysqlStaticProxy@NativeAPI@mysql@sql@@UAEDPAUst_mysql@@D@Z)
5>mysqlcppconn-static.lib(mysql_client_api.obj) : error LNK2019: unresolved external symbol _mysql_more_results@4 referenced in function "public: virtual char __thiscall sql::mysql::NativeAPI::LibmysqlStaticProxy::more_results(struct st_mysql *)" (?more_results@LibmysqlStaticProxy@NativeAPI@mysql@sql@@UAEDPAUst_mysql@@@Z)
5>mysqlcppconn-static.lib(mysql_client_api.obj) : error LNK2019: unresolved external symbol _mysql_next_result@4 referenced in function "public: virtual int __thiscall sql::mysql::NativeAPI::LibmysqlStaticProxy::next_result(struct st_mysql *)" (?next_result@LibmysqlStaticProxy@NativeAPI@mysql@sql@@UAEHPAUst_mysql@@@Z)
5>mysqlcppconn-static.lib(mysql_client_api.obj) : error LNK2019: unresolved external symbol _mysql_stmt_next_result@4 referenced in function "public: virtual int __thiscall sql::mysql::NativeAPI::LibmysqlStaticProxy::stmt_next_result(struct st_mysql_stmt *)" (?stmt_next_result@LibmysqlStaticProxy@NativeAPI@mysql@sql@@UAEHPAUst_mysql_stmt@@@Z)
5>mysqlcppconn-static.lib(mysql_client_api.obj) : error LNK2019: unresolved external symbol _mysql_close@4 referenced in function "public: virtual void __thiscall sql::mysql::NativeAPI::LibmysqlStaticProxy::close(struct st_mysql *)" (?close@LibmysqlStaticProxy@NativeAPI@mysql@sql@@UAEXPAUst_mysql@@@Z)

万一你不想算数:其中有64个。我注意到,我已经安装了64位版本的C ++连接器源和32位版本的C连接器,所以我安装了C Connector 64bits,链接器错误正好加倍(128)。

所以我卸载了两者并安装了两者的32位版本,只是为了回到上面看到的错误。

我知道那些有同样问题的人有很多问题,但我要么找不到可以帮助我的问题,要么就找不到问题。

如果你能指出我的方法,那就太好了。

感谢您的时间

2 个答案:

答案 0 :(得分:2)

经过几天的搜索和测试,我发现了问题。我很惊讶地看到这种情况自2017年甚至更早开始。

问题

MySQL网站上的文档令人困惑,过时且无用。

如果要下载最新的 mysql-connector-c ++-8.0.13-winx64.zip ,则会找到 mysqlcppconn-static.lib 库,该库为64 + MB。您可以在项目BUT中使用它,也将需要.dll,并且该文件仅在发行版中构建。

如果要编译自己的连接器,则仅具有“正确”命令即可。您可以构建x64的STATIC DEBUG版本以在您的应用程序中工作,而无需.dll。

但是,根据发布的OP,您将遇到上述错误。问题是您需要手动链接 mysqlclient.lib 。在哪里找到它?因为在他们的下载页面中,他们说:“ Windows:可从Windows Installer获得客户端实用程序包。”这是错误的。没有这样的东西。

您必须执行的操作是转到MySQL Connector/C (Archived Versions)并下载 mysql-connector-c-6.1.11-winx64-debug.zip 。一旦有了这个,就可以在项目中链接它们:

#pragma comment(lib, "mysqlcppconn-static.lib")
#pragma comment(lib, "mysqlclient.lib") // mysql-connector-c-6.1.11-winx64\lib\vs14\debug

您的项目将在Debug x64和VS2017(对于我而言)下编译并正常工作。

更多问题

提到我提到Oracle提供的mysqlcppconn-static.lib有64 + MB的地方?我之所以这样说,是因为当您/我们建立自己的mysql连接器时,该库将只有大约16 MB。

是的,Oracle以某种方式链接了1个lib中的所有内容。但是,它没有用,因为它在Release中并使用多线程DLL(/ MD)构建,因此,如果您在Debug模式下处理应用程序,它将无法编译,否则将无法调试任何东西。

更多问题

现在,我们发现了如何在x64和DEBUG下构建此MySQL连接器,它仍然仅在多线程调试DLL(/ MDd)下工作。因此,基本上,您不能在/ MT或/ MTd下构建此/您的应用。

建立当前MySQL连接器(称为JDBC)的步骤:

  • 下载最新的母版: https://github.com/mysql/mysql-connector-cpp
  • 下载最新版本    JDBC分支:https://github.com/mysql/mysql-connector-cpp/tree/jdbc
  • 将所有内容从 mysql-connector-cpp-jdbc 复制到 mysql-connector-cpp-master \ jdbc
  • 打开VS 2017的x64本机工具命令提示符并导航到 mysql-connector-cpp-master
  • 运行此命令(假设您要使用STATIC DEBUG):

    cmake -G“ Visual Studio 15 2017 Win64” -DCMAKE_BUILD_TYPE =调试-DBUILD_STATIC = true -DBUNDLE_DEPENDENCIES = ON -DSTATIC_MSVCRT = OFF -DWITH_JDBC = ON

  • 完成后,通过 mysql-connector-cpp-master \ jdbc 中的资源管理器进入 您将看到 MYSQLCPPCONN.sln

  • 从那里开始构建解决方案,您将在其中找到lib mysql-connector-cpp-master \ jdbc \ driver \ Debug

仅此而已,我希望我为解决这一“谜团”所做的努力将对某人有所帮助。我衷心希望Oracle开发人员能够唤醒我们,并在2019年正式创建解决方案和文档。

答案 1 :(得分:1)

  

“我根据官方说明使用CMake生成了项目文件,工作正常。”

我认为你的意思是CMake成功生成了项目,但项目编译不正确。

您是否检查了哪些二进制文件当前与失败的项目相关联?如果没有,我建议右键点击解决方案资源管理器中的项目 - >属性 - >接头

如果CMake缓存了包含所需二进制文件的某些目录,请转到CMake - >文件标签 - >删除缓存,然后重新生成项目。

我能想到的另一件事是检查包含MySQL二进制文件路径的环境变量。如果某些内容已更改为环境变量,则可能需要重新运行CMake,清除其缓存并重新生成项目。

如果您确定要链接二进制文件,则可能存在某些启用静态链接的宏。我不记得是否是MySQL连接器的情况,但这只是想到的另一件事。