c++ - 新手 : Determinate CRT lib used by library

标签 c++ dll visual-c++ visual-c++-6

我正在使用 VC++ 6 开发应用程序。

我有一个第 3 方 DLL。这个库编译为多线程 DLL (/MD) 和我的应用程序。 但是我无法链接:

LINK : warning LNK4075: ignoring /EDITANDCONTINUE due to /INCREMENTAL:NO specification
msvcprtd.lib(MSVCP60D.dll) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::~basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(void)" (??1?$basic_strin
g@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ) already defined in XXXApi.lib(CODbg.obj)
msvcprtd.lib(MSVCP60D.dll) : error LNK2005: "public: __thiscall std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >(class std::basic_string<c
har,struct std::char_traits<char>,class std::allocator<char> > const &)" (??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV01@@Z) already defined in XXXApi.lib(Dictionary.obj)
../../Exes/win2k3_oracle11/XXX.exe : fatal error LNK1169: one or more multiply defined symbols found
Error executing link.exe.

来自 here我看到即使第三个库和我的代码都编译为/MD,也可能与正在使用的旧/新 iostream 发生冲突。

有没有办法确定第 3 方库使用的旧/新 iostream 库?

更新: 第 3 方库是静态的,而不是我之前认为的动态。 lib 编译为/MD。 Dependency Walker 适用于 DLL,而不适用于哪些库。

最佳答案

有依赖Walker,如果你不知道这个工具。 http://dependencywalker.com/

将您的 DLL 或 exe 拖放到主窗口中。它将显示所有依赖项。

如果您想链接到第 3 方 DLL,您所需要的只是为该 DLL 制作的 .lib。 如果您没有那个 .lib,您总是可以使用 pelles c 工具中的 lib.exe 或 polib.exe 创建一个。 polib 更易于使用,因为您不需要编写 .def 文件。 http://www.smorgasbordet.com/pellesc/

希望对您的问题有所帮助。

编辑:您有您正在使用的 .lib 的源代码吗?

关于c++ - 新手 : Determinate CRT lib used by library,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1957341/

相关文章:

c++ - OpenGL - 编译期间出错

c++ - 我如何解析 H264 文件和帧

c++ - C++ 中的异步线程

c++ - 为什么 std::mutex 在带有 WIndows SOCKET 的结构中使用时会创建 C2248?

c++ - 标准库在哪里?

c++ - 模板内本地类成员的名称查找

C++ 在一组字符串对中搜索一个字符串

java - Jar 与 DLL - 它们运行相似吗?

c++ - 有没有办法在加载 dll 时调试发布版本?

C++:重复的静态成员?