[英]Linking to static libraries in Visual Studio 2010
Things to know:要知道的事情:
I've read that I need to use the new UI (Common properties > Add New Reference thingy).我已经读到我需要使用新的 UI(通用属性 > 添加新参考)。 But for this to work, I need to add the entire project to my solution.
但要使其正常工作,我需要将整个项目添加到我的解决方案中。 Is there a way to just link my project to the static library (without adding its source code).
有没有办法将我的项目链接到 static 库(不添加其源代码)。
The 'Add New Reference' thingy is a .NET option, used to add an assembly reference. “添加新参考”是一个 .NET 选项,用于添加装配参考。 You can't create static link libraries in .NET, assemblies are always dynamically loaded.
您不能在 .NET 中创建 static 链接库,程序集始终是动态加载的。 Suspending disbelief and actually answering the question: you use the Browse tab in the dialog to avoid having to add the project to the solution.
暂停怀疑并实际回答问题:您使用对话框中的“浏览”选项卡以避免将项目添加到解决方案中。
Native projects that use a static link library must use the Linker, Input, Additional Dependencies setting instead.使用 static 链接库的本机项目必须改用 Linker、输入、附加依赖项设置。 No need to add the project that generated the.lib either.
也不需要添加生成.lib 的项目。 If you don't specify the full path of the.lib then you can use Linker, General, Additional Linker Directories to tell the linker where to look for the.lib
如果不指定.lib 的完整路径,则可以使用 Linker、General、Additional Linker 目录来告诉 linker 在哪里寻找 lib。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.