MSVC 12 Show where a library is being required

烈酒焚心 提交于 2019-12-11 12:41:51

问题


TL;DR Is there a flag or something that will tell msvc to print out which library/object file requires a given library?

say I get an error message like:

LNK1104 fail to open file: boost_thread-vc120-mt-gd-1_56.lib

I expect this because I haven't told msvc where to find that. But, let's say I want to know why do I need that?.

In other words, let's say I'm linking against foo.lib bar.lib and I've got a bunch of code in my project. Will msvc show me whether it's foo.lib, bar.lib, or my own code that needs it?


回答1:


adding /VERBOSE:REF shows which object files reference which symbols in which libraries, all in a nice indented fashion. This is what I was looking for.




回答2:


In Visual C++ additional libraries can be specified with #pragma comment(lib, "libname.lib") instruction in source code. It may be placed in library headers and is applied when header is included in application sources.



来源:https://stackoverflow.com/questions/31126324/msvc-12-show-where-a-library-is-being-required

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!