简体   繁体   中英

%(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. The setting reads like this

..\\Project1; %(AdditionalIncludeDirectories)

Understand the first part is the path for the program to search for additional program header includes. What about " %(AdditionalIncludeDirectories) " ? what does it mean?

It does not seem to be a macro which I understand is headed by "$" eg $MACRO

Thanks

Answer

In the documentation for Working with Project Properties there is a section on "item macros":

Item macros

Has the syntax %(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. This kind of item macro corresponds to an ItemGroup metadata in MSBuild. 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. This kind of item macro corresponds to an ItemDefinitionGroup metadata in MSBuild. 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)

附加包含目录弹出窗口

And oddly the %(AdditionalIncludeDirectories) element is not included in the edit box

其他包含目录的编辑框

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.

The documentation for both the Additional Include Directories compiler options and the AdditionalIncludeDirectories VCCL Compiler Tool property contain no mention of this %(NAME) pattern.

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. 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. Later versions of Visual Studio can't convert projects from Visual Studio 2008 and earlier to the new project type. 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. For more information, see Overview of potential upgrade issues.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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