building static library (.lib) VS 2010 Pro
I have a newbie question about building a static library in VS 2010 Pro.
When you choose to build a static library (.lib) instead of an application, the Linker option in project properties disappears. Normally I go to Linker->Input->Additional Dependencies to add the needed .lib files for a project.
I've built the library and added it to my main application project under Linker->Input->Additional Dependencies. Now when I go to build my main application (with the above static library included in the project .lib files), I am getting a linker error about a method used in the library.
Where do I add the required .lib files when building the static library?
A Static library is linked with your executable. Any dependencies that your static library has (external libraries it requires) must also be specified in your executable.
So, if libA
requires libB
, then an application that links with libA
will also have to link with libB
.
最简单的方法是在其链接器页面中将依赖.lib添加到主应用程序。
如果库A总是依赖于库B,那么可以强制库A发生在其中一个源文件中。例如:
#pragma comment(lib, "wininet.lib")
链接地址: http://www.djcxy.com/p/64368.html