Friday, January 22, 2021

VC++ Directories -> Include Directories VS. C/C++ -> General -> Additional include directories

What is the difference between "VC++ Directories -> Include Directories" and "C/C++ -> General -> Additional include directories"?

  1. VC++ Directories, Projects and Solutions, Options Dialog Box
  2. This dialog box allows you to specify directories where the Visual Studio project system should look for files. You can specify as many directories as you want. For special situations, you can remove standard Visual Studio directories, so that your versions of build files are found rather than the Visual Studio defaults.

  3. What is the difference between "VC++ Directories -> Include Directories" and "C/C++ -> General -> Additional include directories"?
  4. I love property sheets and I'm now making a property sheet with various paths and macros for easy inclusion of a library. However I'm not sure if I should add include search paths to the "VC++ Directories -> Include Directories"s property or the "C/C++ -> General -> Additional include directories" property of my property sheet. Is there any practical difference?

    There is also similar problems for library directories.

    VC++ Directories -> Include Directories sets the INCLUDE environment variable, which decides where to look for the header file. "C/C++ -> General -> Additional include directories" passes the additional include directories with the /FI switch to the CL compiler.

    Before VS2010, VC++ Directories -> Include Directories is not per project but per Visual Studio session. In VS2010, since VC++ Directories -> Include Directories is part of the properties sheet, it is per project or even per user, if they are added to the microsoft.cpp.<platform >.user.props file.

    Directories defined in C/C++ -> General -> Additional include directories take precedence over the directories defined in VC++ Directories -> Include Directories. Other than that, in VS2010, there is practically not much difference between these two properties. However, we still need to keep these two properties so to support applications migrated from previous versions which have used VC++ Directories -> Include Directories.

  5. What 's difference between "Include Directories" and "Additional Include Directories"
  6. In VC 2010, there're two place to configure include path:

    1. VC++ Directories -> Include Directories
    2. C/C++ -> General -> Additional Include Directories

    What 's difference between "Include Directories" and "Additional Include Directories"?

    >>1. VC++ Directories -> Include Directories Do you mean "Tools->Options->Projects and Solutions->VC++ Directories->Include file“?

    >> 2. C/C++ -> General -> Additional Include Directories

    Do you mean “right-click project->properties->Configuration Propeties->C/C++->General-> Additional Include Directories ”

    If you mean that , the setting in Options is used for all VS, but the setting in Properties is used only for this project.

    In addition , “VC++ Directories -> Include Directories” : Directory settings displayed in the window are the directories that Visual Studio will search for include files referred to in your source code files. Corresponds to environment variable INCLUDE.

    “C/C++ -> General -> Additional Include Directories”: The directory to be added to the list of directories searched for include files.

  7. Set compiler and build properties
  8. In the IDE, all information that is needed to build a project is exposed as properties. This information includes the application name, extension (such as DLL, LIB, EXE), compiler options, linker options, debugger settings, custom build steps, and many other things. Typically, you use property pages to view and modify these properties. To access the property pages, choose Project > projectname Properties from the main menu, or right-click on the project node in Solution Explorer and choose Properties.

    Predefined macros

    global macros: Applies to all items in a project configuration. Has the syntax $(name). An example of a global macro is $(VCInstallDir), which stores the root directory of your Visual Studio installation. A global macro corresponds to a PropertyGroup in MSBuild.

    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.

  9. What is the difference between “Include Directories” and “Additional Include Directories”
  10. In configuration properties of my project, under the "VC++ directories" there is an entry for "Include Directories". But under "C/C++" option, there is another entry called "Additional Include Directories". Same thing happens with library directories.

    What are the difference between these two entries?.

    This is awkwardness that got introduced in VS2010. The VC++ Directories settings used to be located in Tools + Options, Projects and Solutions, VC++ Directories. Global settings that applied to every project that was built on the machine. It is still there but points out that you should now change it in your project settings. A side-effect of the build engine overhaul in VS2010, enabling building with msbuild. Removing the per-project settings would have been logical but that would break too many existing projects.

    As such, it is probably best to treat the VC++ Directories settings as the machine default. It is automatically preset by the VS installer. Tinker with it only if you need an unusual directory search order, putting the custom locations last. Very unusual to do so.

    It does work however. And it did get taken advantage of eventually. Empowering the Platform Toolset setting in VS2012 and up. Different compiler, different linker, different #include directories, different linker search path. Modified with just one setting, nice.

  11. /I (Additional Include Directories)
  12. Adds a directory to the list of directories searched for include files.

  13. Environment variable - Wikipedia
  14. An environment variable is a dynamic-named value that can affect the way running processes will behave on a computer. They are part of the environment in which a process runs. For example, a running process can query the value of the TEMP environment variable to discover a suitable location to store temporary files, or the HOME or USERPROFILE variable to find the directory structure owned by the user running the process.

  15. How to: Copy Resources
  16. You can copy resources from one file to another without changing them or you can change the language or condition of a resource while copying it.

  17. How to: Specify Include Directories for Resources
  18. This is a paragraph.

No comments:

Post a Comment