简体   繁体   English

如何将Visual Studio设置为仅使用lib文件?

[英]How to set Visual Studio to work with only lib files?

so I have a Win32 consol project using libraries like openCV and FFmpeg (builds). 因此,我有一个使用openCV和FFmpeg(构建)之类的库的Win32 consol项目。 I have DLLs, .Libs, heders for tham all. 我有DLL,.libs和tham。 How to set visual studio project not to use DLLs but only lib files? 如何设置Visual Studio项目不使用DLL而是仅使用lib文件?

I assume you are talking about static libs and not using DLLs. 我假设您是在谈论静态库而不是使用DLL。 If you have a dependency on static libs do this 如果您对静态库有依赖性,请执行此操作

Right click on your project -> Properties -> Linker -> General -> Additional Library Dependencies Specify your library directories. 右键单击您的项目->属性->链接器->常规->其他库依赖关系指定您的库目录。 Right click on your project -> Properties -> Linker -> Input -> Additional Dependencies. 右键单击项目->属性->链接器->输入->其他依赖项。 Specify your static lib file names. 指定您的静态lib文件名。

If any of you library isn't static library then you would need the dll to run your project. 如果您的任何库不是静态库,那么您将需要dll来运行您的项目。

Well it depends if the .lib files are static libraries or import libraries for the DLL. 好吧,这取决于.lib文件是静态库还是DLL的导入库。 If they're import libraries, you have no choice, you're program will have to be dynamically linked with the DLLs. 如果它们是导入库,则别无选择,您的程序将必须与DLL动态链接。 If they're static libraries, than just add them to your project. 如果它们是静态库,则只需将它们添加到您的项目中即可。 You can add them under project settings->configuration properties->linker->input->additional dependencies , drag and drop them into your project, or use the preprocessor directive #pragma comment(lib, <libname>) 您可以在项目设置->配置属性->链接器->输入->其他依赖项下添加它们,将它们拖放到项目中,或使用预处理程序指令#pragma comment(lib, <libname>)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM