gpt4 book ai didi

c++ - 在 C++ 中,是否可以链接到使用早期版本的 Visual Studio 编译的 .lib 文件?

转载 作者:太空宇宙 更新时间:2023-11-04 12:04:24 25 4
gpt4 key购买 nike

我有一个项目,我们希望将其从 Visual Studio 6 移植到 Visual Studio 2010。

该项目依赖于预编译的第 3 方 .LIB 文件。此第 3 方库仅包含 .H 头文件(无 .CPP 文件)

我刚刚对 visual studio 2010 解决方案进行了快速导入,但在链接时遇到了很多错误!

其中一些错误涉及第 3 方 .lib 文件“ServerToolkitRuntimeLIB.LIB”

这是我构建输出的小片段:

1>ServerToolkitRuntimeLIB.LIB(SerialIO.obj) : error LNK2001: unresolved external symbol "void  __cdecl std::_Xlen(void)" (?_Xlen@std@@YAXXZ)
1>ServerToolkitRuntimeLIB.LIB(OPCConversions.obj) : error LNK2001: unresolved external symbol "void __cdecl std::_Xlen(void)" (?_Xlen@std@@YAXXZ)
1>ServerToolkitRuntimeLIB.LIB(OPCMemoryAS.obj) : error LNK2001: unresolved external symbol "void __cdecl std::_Xlen(void)" (?_Xlen@std@@YAXXZ)
1>ServerToolkitRuntimeLIB.LIB(OPCAddressSpace.obj) : error LNK2001: unresolved external symbol "void __cdecl std::_Xlen(void)" (?_Xlen@std@@YAXXZ)
1>ServerToolkitRuntimeLIB.LIB(OPCServer.obj) : error LNK2001: unresolved external symbol "void __cdecl std::_Xlen(void)" (?_Xlen@std@@YAXXZ)

如果没有重建第 3 方库的源代码,我是在无所事事吗?还是这里会发生其他事情?

提前谢谢你。

编辑:第 3 方 .lib 最初是在 Visual Studio 6.0 中编译的

最佳答案

如果你有 VS6,你可以尝试在那里生成一个 DLL,链接到你拥有的那个 .lib 文件,并导出必要的符号。

然后您可以在 VS 2010 项目中动态链接该 dll,而无需使用 .lib

关于c++ - 在 C++ 中,是否可以链接到使用早期版本的 Visual Studio 编译的 .lib 文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12835824/

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