C++ Visual Studio 项目属性中没有链接器选项
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5234899/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
No Linker option in Visual Studio Project Properties
提问by user346443
I'm trying to add a library to a Visual Studio C++ project, however, when I go to project properties I only have options for,
我正在尝试向 Visual Studio C++ 项目添加一个库,但是,当我转到项目属性时,我只有以下选项,
Common Properties
Startup Project
Project Dependencies
Debug Source File
Configuration Properites
Configuration
Why can't I see the linker options?
为什么我看不到链接器选项?
回答by edward king
Updating answer for VS2012 to cover executable and libraries.
更新 VS2012 的答案以涵盖可执行文件和库。
If your project is an executable then you need to navigate as such: Myproject --> properties --> linker --> additional dependencies and add the dll or lib.
如果您的项目是一个可执行文件,那么您需要这样导航:Myproject --> properties --> linker --> additional dependencies 并添加 dll 或 lib。
If you project is a library, there is no "linker" tab so you need to navigate as such: Myproject -->properties --> Librarian --> additional dependencies and add the dll or lib
如果您的项目是一个库,则没有“链接器”选项卡,因此您需要这样导航:Myproject -->properties --> Librarian --> 附加依赖项并添加 dll 或 lib
回答by Michael Burr
You are looking at the properties for the Solution.
您正在查看Solution的属性。
You'll need to open the properties for the specific project within that solution.
您需要打开该解决方案中特定项目的属性。
回答by Tobold
Are you by any chance looking at a library project? Quoted from this answer:
您是否有机会查看图书馆项目?引自这个答案:
A library is just a collection of objects, which by definition have not been linked yet. The linker is not used to create the library, so it makes sense that there would be no linker options for it.
库只是对象的集合,根据定义,这些对象尚未链接。链接器不用于创建库,因此它没有链接器选项是有道理的。
回答by AmitB
In Visual Studio 2013:
在 Visual Studio 2013 中:
Go to: Project Properties -> Configuration Manager -> General. There, under Project Defaults, change the Configuration Type to either Dynamic Library or Application. Click on Apply. Then you should see the Linker tab added to the menu on the left.
转到:项目属性 -> 配置管理器 -> 常规。在那里,在项目默认值下,将配置类型更改为动态库或应用程序。单击应用。然后您应该会看到左侧菜单中添加了链接器选项卡。
回答by Kevin
If the Configuration Type (Configuration Properties -> General -> Configuration Type) is set to Utility, then no linker option will be available.
如果配置类型(配置属性 -> 常规 -> 配置类型)设置为实用程序,则没有链接器选项可用。
回答by Sai Gollapudi
Either you are looking at the "solution" level or at a file level (e.g. main.cpp). Move to project level and you will see the Linker.
您正在查看“解决方案”级别或文件级别(例如 main.cpp)。移至项目级别,您将看到链接器。