gpt4 book ai didi

c++ - 从 VS2012 项目链接使用 VS2008 构建的静态库?它们兼容吗?

转载 作者:太空狗 更新时间:2023-10-29 21:47:56 24 4
gpt4 key购买 nike

我有一堆静态 .lib 文件,包括链接到我的项目中的 mysqlclient.lib、v8_base.lib 和 mysqlpp.lib,这些都是使用 Visual Studio 2008 构建的,它们是使用/MT 运行时库选项构建的.

我刚刚尝试升级到 VS2012 并且代码编译正常但是当项目链接时我收到以下错误(总共超过 500 个错误):

Error   47  error LNK2019: unresolved external symbol "public: __thiscall std::_Mutex::~_Mutex(void)" (??1_Mutex@std@@QAE@XZ) referenced in function "public: void __thiscall std::ios_base::clear(int,bool)" (?clear@ios_base@std@@QAEXH_N@Z)  D:\server\mysqlpp.lib(dbdriver.obj) server
Error 48 error LNK2001: unresolved external symbol "public: __thiscall std::_Mutex::~_Mutex(void)" (??1_Mutex@std@@QAE@XZ) D:\server\mysqlpp.lib(datetime.obj) server
Error 49 error LNK2001: unresolved external symbol "public: __thiscall std::_Mutex::~_Mutex(void)" (??1_Mutex@std@@QAE@XZ) D:\server\mysqlpp.lib(stadapter.obj) server
Error 50 error LNK2001: unresolved external symbol "public: __thiscall std::_Mutex::~_Mutex(void)" (??1_Mutex@std@@QAE@XZ) D:\server\mysqlpp.lib(sqlstream.obj) server
Error 51 error LNK2001: unresolved external symbol "public: __thiscall std::_Mutex::~_Mutex(void)" (??1_Mutex@std@@QAE@XZ) D:\server\mysqlpp.lib(connection.obj) server
Error 52 error LNK2001: unresolved external symbol "public: __thiscall std::_Mutex::~_Mutex(void)" (??1_Mutex@std@@QAE@XZ) D:\server\mysqlpp.lib(mystring.obj) server
Error 53 error LNK2001: unresolved external symbol "public: __thiscall std::_Mutex::~_Mutex(void)" (??1_Mutex@std@@QAE@XZ) D:\server\mysqlpp.lib(row.obj) server
Error 54 error LNK2001: unresolved external symbol "public: __thiscall std::_Mutex::~_Mutex(void)" (??1_Mutex@std@@QAE@XZ) D:\server\mysqlpp.lib(query.obj) server
Error 55 error LNK2001: unresolved external symbol "long const std::_BADOFF" (?_BADOFF@std@@3JB) D:\server\mysqlpp.lib(dbdriver.obj) server
Error 56 error LNK2001: unresolved external symbol "long const std::_BADOFF" (?_BADOFF@std@@3JB) D:\server\mysqlpp.lib(datetime.obj) server
Error 57 error LNK2001: unresolved external symbol "long const std::_BADOFF" (?_BADOFF@std@@3JB) D:\server\mysqlpp.lib(stadapter.obj) server
Error 58 error LNK2001: unresolved external symbol "long const std::_BADOFF" (?_BADOFF@std@@3JB) D:\server\mysqlpp.lib(sqlstream.obj) server
Error 59 error LNK2001: unresolved external symbol "long const std::_BADOFF" (?_BADOFF@std@@3JB) D:\server\mysqlpp.lib(connection.obj) server
Error 60 error LNK2001: unresolved external symbol "long const std::_BADOFF" (?_BADOFF@std@@3JB) D:\server\mysqlpp.lib(mystring.obj) server
Error 61 error LNK2001: unresolved external symbol "long const std::_BADOFF" (?_BADOFF@std@@3JB) D:\server\mysqlpp.lib(row.obj) server
Error 62 error LNK2001: unresolved external symbol "long const std::_BADOFF" (?_BADOFF@std@@3JB) D:\server\mysqlpp.lib(query.obj) server
Error 63 error LNK2001: unresolved external symbol "public: static void __cdecl std::_String_base::_Xran(void)" (?_Xran@_String_base@std@@SAXXZ) D:\server\mysqlpp.lib(qparms.obj) server
Error 64 error LNK2001: unresolved external symbol "public: static void __cdecl std::_String_base::_Xran(void)" (?_Xran@_String_base@std@@SAXXZ) D:\server\mysqlpp.lib(sqlstream.obj) server
Error 65 error LNK2001: unresolved external symbol "public: static void __cdecl std::_String_base::_Xran(void)" (?_Xran@_String_base@std@@SAXXZ) D:\server\mysqlpp.lib(options.obj) server
Error 66 error LNK2001: unresolved external symbol "public: static void __cdecl std::_String_base::_Xran(void)" (?_Xran@_String_base@std@@SAXXZ) D:\server\mysqlpp.lib(field_types.obj) server
Error 67 error LNK2019: unresolved external symbol "public: static void __cdecl std::_String_base::_Xran(void)" (?_Xran@_String_base@std@@SAXXZ) referenced in function "public: char __thiscall mysqlpp::SQLTypeAdapter::at(unsigned int)const " (?at@SQLTypeAdapter@mysqlpp@@QBEDI@Z) D:\server\mysqlpp.lib(stadapter.obj) server
Error 68 error LNK2001: unresolved external symbol "public: static void __cdecl std::_String_base::_Xran(void)" (?_Xran@_String_base@std@@SAXXZ) D:\server\mysqlpp.lib(manip.obj) server
Error 69 error LNK2001: unresolved external symbol "public: static void __cdecl std::_String_base::_Xran(void)" (?_Xran@_String_base@std@@SAXXZ) D:\server\mysqlpp.lib(null.obj) server
Error 70 error LNK2001: unresolved external symbol "public: static void __cdecl std::_String_base::_Xran(void)" (?_Xran@_String_base@std@@SAXXZ) D:\server\mysqlpp.lib(datetime.obj) server
Error 71 error LNK2001: unresolved external symbol "public: static void __cdecl std::_String_base::_Xran(void)" (?_Xran@_String_base@std@@SAXXZ) D:\server\mysqlpp.lib(type_info.obj) server
Error 72 error LNK2001: unresolved external symbol "public: static void __cdecl std::_String_base::_Xran(void)" (?_Xran@_String_base@std@@SAXXZ) D:\server\mysqlpp.lib(vallist.obj) server
Error 73 error LNK2001: unresolved external symbol "public: static void __cdecl std::_String_base::_Xran(void)" (?_Xran@_String_base@std@@SAXXZ) D:\server\mysqlpp.lib(field_names.obj) server
Error 74 error LNK2001: unresolved external symbol "public: static void __cdecl std::_String_base::_Xran(void)" (?_Xran@_String_base@std@@SAXXZ) D:\server\mysqlpp.lib(query.obj) server
Error 75 error LNK2001: unresolved external symbol "public: static void __cdecl std::_String_base::_Xran(void)" (?_Xran@_String_base@std@@SAXXZ) D:\server\mysqlpp.lib(dbdriver.obj) server
Error 76 error LNK2001: unresolved external symbol "public: static void __cdecl std::_String_base::_Xran(void)" (?_Xran@_String_base@std@@SAXXZ) D:\server\mysqlpp.lib(tcp_connection.obj) server
Error 77 error LNK2001: unresolved external symbol "public: static void __cdecl std::_String_base::_Xran(void)" (?_Xran@_String_base@std@@SAXXZ) D:\server\mysqlpp.lib(uds_connection.obj) server
Error 78 error LNK2001: unresolved external symbol "public: static void __cdecl std::_String_base::_Xran(void)" (?_Xran@_String_base@std@@SAXXZ) D:\server\mysqlpp.lib(connection.obj) server
Error 79 error LNK2001: unresolved external symbol "public: static void __cdecl std::_String_base::_Xran(void)" (?_Xran@_String_base@std@@SAXXZ) D:\server\mysqlpp.lib(mystring.obj) server
Error 80 error LNK2001: unresolved external symbol "public: static void __cdecl std::_String_base::_Xran(void)" (?_Xran@_String_base@std@@SAXXZ) D:\server\mysqlpp.lib(row.obj) server
Error 81 error LNK2001: unresolved external symbol "public: static void __cdecl std::_String_base::_Xran(void)" (?_Xran@_String_base@std@@SAXXZ) D:\server\mysqlpp.lib(result.obj) server
Error 82 error LNK2001: unresolved external symbol "public: static void __cdecl std::_String_base::_Xlen(void)" (?_Xlen@_String_base@std@@SAXXZ) D:\server\mysqlpp.lib(null.obj) server
Error 83 error LNK2001: unresolved external symbol "public: static void __cdecl std::_String_base::_Xlen(void)" (?_Xlen@_String_base@std@@SAXXZ) D:\server\mysqlpp.lib(qparms.obj) server
Error 84 error LNK2001: unresolved external symbol "public: static void __cdecl std::_String_base::_Xlen(void)" (?_Xlen@_String_base@std@@SAXXZ) D:\server\mysqlpp.lib(sqlstream.obj) server
Error 85 error LNK2001: unresolved external symbol "public: static void __cdecl std::_String_base::_Xlen(void)" (?_Xlen@_String_base@std@@SAXXZ) D:\server\mysqlpp.lib(field_types.obj) server
Error 86 error LNK2001: unresolved external symbol "public: static void __cdecl std::_String_base::_Xlen(void)" (?_Xlen@_String_base@std@@SAXXZ) D:\server\mysqlpp.lib(stadapter.obj) server
Error 87 error LNK2001: unresolved external symbol "public: static void __cdecl std::_String_base::_Xlen(void)" (?_Xlen@_String_base@std@@SAXXZ) D:\server\mysqlpp.lib(manip.obj) server
Error 88 error LNK2001: unresolved external symbol "public: static void __cdecl std::_String_base::_Xlen(void)" (?_Xlen@_String_base@std@@SAXXZ) D:\server\mysqlpp.lib(utility.obj) server
Error 89 error LNK2001: unresolved external symbol "public: static void __cdecl std::_String_base::_Xlen(void)" (?_Xlen@_String_base@std@@SAXXZ) D:\server\mysqlpp.lib(datetime.obj) server
Error 90 error LNK2001: unresolved external symbol "public: static void __cdecl std::_String_base::_Xlen(void)" (?_Xlen@_String_base@std@@SAXXZ) D:\server\mysqlpp.lib(type_info.obj) server
Error 91 error LNK2001: unresolved external symbol "public: static void __cdecl std::_String_base::_Xlen(void)" (?_Xlen@_String_base@std@@SAXXZ) D:\server\mysqlpp.lib(vallist.obj) server
Error 92 error LNK2001: unresolved external symbol "public: static void __cdecl std::_String_base::_Xlen(void)" (?_Xlen@_String_base@std@@SAXXZ) D:\server\mysqlpp.lib(field_names.obj) server
Error 93 error LNK2001: unresolved external symbol "public: static void __cdecl std::_String_base::_Xlen(void)" (?_Xlen@_String_base@std@@SAXXZ) D:\server\mysqlpp.lib(query.obj) server
Error 94 error LNK2001: unresolved external symbol "public: static void __cdecl std::_String_base::_Xlen(void)" (?_Xlen@_String_base@std@@SAXXZ) D:\server\mysqlpp.lib(dbdriver.obj) server
Error 95 error LNK2001: unresolved external symbol "public: static void __cdecl std::_String_base::_Xlen(void)" (?_Xlen@_String_base@std@@SAXXZ) D:\server\mysqlpp.lib(tcp_connection.obj) server

VS2012 标准库定义的运行时符号是否与 VS2008 提供的不同?

最佳答案

您看到的问题是由于 STL 和作为 C++ 一部分的其他库的差异造成的。您可以尝试以下链接器开关:

/NODEFAULTLIB[:library]

当在 VS2008 端构建它时,如果您不能这样做,那么您就不走运了。基本上,您必须做的是摆脱标准库,从而将解析它们的任务委托(delegate)给稍后使用生成的静态 .lib 的链接器。

我应该补充一点,您还需要确保您只使用收件人图书馆知道的功能。

关于c++ - 从 VS2012 项目链接使用 VS2008 构建的静态库?它们兼容吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12074439/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com