简体   繁体   English

%(AdditionalIncludeDirectories)含义

[英]%(AdditionalIncludeDirectories) meaning

Think this will be rather simple but somehow I could not find a reference saying about this. 认为这将是相当简单但不知何故我找不到关于此的参考。

In the MSVC Include directories, there is an Additional Include Directories setting. 在MSVC Include目录中,有一个Additional Include Directories设置。 The setting reads like this 设置如下

..\\Project1; .. \\ PROJECT1; %(AdditionalIncludeDirectories) %(AdditionalIncludeDirectories)

Understand the first part is the path for the program to search for additional program header includes. 理解第一部分是程序搜索附加程序头包含的路径。 What about " %(AdditionalIncludeDirectories) " ? 那么“%(AdditionalIncludeDirectories)”怎么样? what does it mean? 这是什么意思?

It does not seem to be a macro which I understand is headed by "$" eg $MACRO 它似乎不是一个宏,我理解的是以“$”为首,例如$ MACRO

Thanks 谢谢

Answer 回答

In the documentation for Working with Project Properties there is a section on "item macros": 使用项目属性的文档中有一个关于“项宏”的部分:

Item macros 项目宏

Has the syntax %(name) . 语法为%(name) For a file, an item macro applies only to that file—for example, you can use %(AdditionalIncludeDirectories) to specify include directories that apply only to a particular file. 对于文件,项宏仅适用于该文件 - 例如,您可以使用%(AdditionalIncludeDirectories)指定仅适用于特定文件的包含目录。 This kind of item macro corresponds to an ItemGroup metadata in MSBuild. 这种项宏对应于MSBuild中的ItemGroup元数据。 When it's used in the context of a project configuration, an item macro applies to all files of a certain type. 当它在项目配置的上下文中使用时,项宏将应用于特定类型的所有文件。 For example, the C/C++ Preprocessor Definitions configuration property can take a %(PreprocessorDefinitions) item macro that applies to all .cpp files in the project. 例如,C / C ++ 预处理器定义配置属性可以采用%(PreprocessorDefinitions)项宏,该宏适用于项目中的所有.cpp文件。 This kind of item macro corresponds to an ItemDefinitionGroup metadata in MSBuild. 这种项宏对应于MSBuild中的ItemDefinitionGroup元数据。 For more information, see Item Definitions . 有关更多信息,请参阅项目定义

Discussion 讨论

I had exactly the same problem in a project I am taking over from a former developer : his Additional Include Directories are C:\\Users\\t-tshmit\\Downloads\\DirectXTK;$(ProjectDir);$(IntermediateOutputPath);%(AdditionalIncludeDirectories) 我在一个前开发人员接管的项目中遇到了完全相同的问题:他的附加包含目录是C:\\Users\\t-tshmit\\Downloads\\DirectXTK;$(ProjectDir);$(IntermediateOutputPath);%(AdditionalIncludeDirectories)

附加包含目录弹出窗口

And oddly the %(AdditionalIncludeDirectories) element is not included in the edit box 奇怪的是, %(AdditionalIncludeDirectories)元素不包含在编辑框中

其他包含目录的编辑框

Looking around the web I could not find much on this, but it is clearly a pattern in use, for example the screenshot used in http://www.steptools.com/support/stdev_docs/help/settings_vc10.html may contain the %(AdditionalIncludeDirectories) element. 环顾网络我找不到这个,但它显然是一个正在使用的模式,例如http://www.steptools.com/support/stdev_docs/help/settings_vc10.html中使用的屏幕截图可能包含%(AdditionalIncludeDirectories)元素。

The documentation for both the Additional Include Directories compiler options and the AdditionalIncludeDirectories VCCL Compiler Tool property contain no mention of this %(NAME) pattern. Additional Include Directories编译器选项AdditionalIncludeDirectories VCCL编译器工具属性的文档不包含此%(NAME)模式。

https://docs.microsoft.com/en-us/cpp/build/reference/common-macros-for-build-commands-and-properties?view=vs-2019 https://docs.microsoft.com/en-us/cpp/build/reference/common-macros-for-build-commands-and-properties?view=vs-2019

They are called "item metadata macros." 它们被称为“项目元数据宏”。

The build system for C++ was significantly changed between Visual Studio 2008 and Visual Studio 2010. Many macros used in earlier project types have been changed to new ones. 在Visual Studio 2008和Visual Studio 2010之间,C ++的构建系统发生了显着变化。早期项目类型中使用的许多宏已更改为新的宏。 These macros are no longer used or have been replaced by one or more equivalent properties or item metadata macro (%(name)) values. 这些宏不再使用或已被一个或多个等效属性或项元数据宏(%(名称))值替换。 Macros that are marked "migrated" can be updated by the project migration tool. 标记为“已迁移”的宏可以由项目迁移工具更新。 If the project that contains the macro is migrated from Visual Studio 2008 or earlier to Visual Studio 2010, Visual Studio converts the macro to the equivalent current macro. 如果包含宏的项目从Visual Studio 2008或更早版本迁移到Visual Studio 2010,则Visual Studio会将宏转换为等效的当前宏。 Later versions of Visual Studio can't convert projects from Visual Studio 2008 and earlier to the new project type. 更高版本的Visual Studio无法将项目从Visual Studio 2008及更早版本转换为新项目类型。 You must convert these projects in two steps; 您必须分两步转换这些项目; first convert them to Visual Studio 2010, and then convert the result to your newer version of Visual Studio. 首先将它们转换为Visual Studio 2010,然后将结果转换为较新版本的Visual Studio。 For more information, see Overview of potential upgrade issues. 有关更多信息,请参阅潜在升级问题概述。

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

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