C++ 文件如何进入 MSVC++2010 中的外部依赖项?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6769760/
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
How do files get into the External Dependencies in MSVC++2010?
提问by Felix Dombek
I wonder why one of my projects has VDSERR.h listed under "External Dependencies" and another hasn't and gives me an "undefined symbol" compiler error about a symbol which is defined in there. How can I include this file in the other project as well? (Probably by drag&drop, but I'd like to know the exact setting here.)
我想知道为什么我的一个项目在“外部依赖关系”下列出了 VDSERR.h,而另一个项目没有,并给我一个关于在那里定义的符号的“未定义符号”编译器错误。我怎样才能在另一个项目中包含这个文件?(可能通过拖放操作,但我想知道这里的确切设置。)
回答by James McNellis
The External Dependencies folder is populated by IntelliSense: the contents of the folder do not affect the build at all (you can in fact disable the folder in the UI).
External Dependencies 文件夹由 IntelliSense 填充:该文件夹的内容根本不影响构建(实际上您可以在 UI 中禁用该文件夹)。
You need to actually include the header (using a #include
directive) to use it. Depending on what that header is, you may also need to add its containing folder to the "Additional Include Directories" property and you may need to add additional libraries and library folders to the linker options; you can set all of these in the project properties (right click the project, select Properties). You should compare the properties with those of the project that does build to determine what you need to add.
您需要实际包含标题(使用#include
指令)才能使用它。根据该标头是什么,您可能还需要将其包含文件夹添加到“附加包含目录”属性中,并且您可能需要将其他库和库文件夹添加到链接器选项中;您可以在项目属性中设置所有这些(右键单击项目,选择属性)。您应该将这些属性与构建的项目的属性进行比较,以确定您需要添加的内容。