新手:确定库使用的 CRT 库

发布于 2024-08-15 12:10:56 字数 1514 浏览 7 评论 0原文

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

我有一个第三方 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 发生冲突。

有没有办法确定 3rd 方库使用哪个 iostream 库旧/新?

UPD: 第 3 方库是静态的,而不是我之前认为的动态的。 该库编译为 /MD。 Dependency Walker 与 DLL 一起工作,而不是与哪些库一起工作。

I'm developing application using VC++ 6.

I have a 3rd party DLL. This library compiled as Multithreaded DLL (/MD) and my application too.
But I fail to link:

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.

From here I see that even though both 3rd library and my code compiled as /MD, there's possibly conflict with old/new iostream beining used.

Is there way to determinate what iostream library old/new is used by 3rd party library?

UPD:
The 3rd party lib is static and not dynamic as I thought before.
The lib is compiled /MD. Dependency Walker works wirh DLLs and not which Libs.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

亚希 2024-08-22 12:10:56

如果您不知道这个工具,则有依赖项 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 的源代码吗?

There is dependency Walker, if you don't know this tool.
http://dependencywalker.com/

Drag and drop your DLL or exe on the main window. It will show all dependencies.

And if you want to link to a 3rd party DLL, all you need is a .lib made for that DLL.
If you don't have that .lib, you can always make one using lib.exe or polib.exe from pelles c tools.
polib is easier to use because you don't need to write a .def file.
http://www.smorgasbordet.com/pellesc/

I hope it helps for your question.

Edit: Do you have the source code for the .lib you are using?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文