即使我设置了 /MT 选项,为什么我仍会看到 MSVCR90 依赖项?
我正在 Visual C++ 2008 中构建一个 DLL,并且希望将运行时静态链接到该 DLL 中。因此,我进入项目选项并将运行时库设置为多线程 (/MT)
。这在过去一直适用于其他项目。但当我构建这个时,我仍然会看到 Dependency Walker 在列表中显示 MSVCR90.dll。
有人知道是什么原因造成的吗?
I'm building a DLL in Visual C++ 2008, and I want to have the runtime statically linked into the DLL. So I went into the project options and set Runtime Library to Multi-threaded (/MT)
. This has always worked for other projects in the past. But when I build this one, I still end up with Dependency Walker showing MSVCR90.dll in the list.
Anyone know what could cause that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
项目+属性、链接器、命令行。添加 /verbose 选项。构建+重建。输出窗口显示链接器搜索符号。请注意 msvcrt.lib,它会引入对 msvcr90.dll 的依赖。
典型原因是链接的 .lib 包含一个或多个使用 /MD 编译的 .obj 文件。对 msvcrt.lib 的依赖项通过 #pragma comment(lib, msvcrt.lib) 指令注入。这告诉链接器搜索 msvcrt.lib,而无需您在“链接器”、“输入”、“附加依赖项”中显式将其指定为依赖项。
Project + Properties, Linker, Command Line. Add the /verbose option. Build + Rebuild. The Output window shows you the linker searching for symbols. Watch out for msvcrt.lib, that's the one that pulls in the dependency on msvcr90.dll
The typical cause is linking a .lib that has one or more .obj files that were compiled with /MD. A dependency on msvcrt.lib gets injected with the #pragma comment(lib, msvcrt.lib) directive. That tells the linker to search msvcrt.lib without you explicitly specifying it as a dependency in Linker, Input, Additional Dependencies.