即使我设置了 /MT 选项,为什么我仍会看到 MSVCR90 依赖项?

发布于 2024-11-16 05:29:54 字数 190 浏览 2 评论 0原文

我正在 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 技术交流群。

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

发布评论

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

评论(1

一场信仰旅途 2024-11-23 05:29:54

项目+属性、链接器、命令行。添加 /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.

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