开发者

Why do I see a MSVCR90 dependency even though I set the /MT option?

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 opt开发者_高级运维ions 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?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜