我正在使用 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/