Make custom "include" folder permanent...

We have a folder containing custom header files which will be used in pretty much every program we create. We know how to add this folder path to each new project under Project Properties->Configuration Properties->C/C++->General->Additional Include Directories, and this works well. However, is there a way to add this folder to the Visual C++ settings to make it permanent so that we do not have to go through the annoyance of adding the custom folder to every new project?

We have tried adding the folder under Project Properties->Configuration Properties->VC++ Directories->Include Directories, but this action does not work for us, as our apps ill not read the header files from the folder when specified here. Yes, we are properly declaring each header file using #Include in our source files.

Using Visual Studio 2019 Professional
Hello GypsyPrince,

The quick solution would be to put a path before the file name then you could store the header files where you want. I have not tried this using the <>, but I f know it will work with the double quotes. Once you have this you can copy it to the toolbox and use it from there.

I have found with 2015 and 2017 the subdirectory that contains the file like "iostream" is marked "read only" which makes it difficult to add new files, but I did find a way around this just do not remember how.

Another possibility is to check all the include paths and see if any one of them is not "read only" and put you header files there.

For now using a path may be easier until you can figure out something else.

All the versions I have used are the "Community", but that should not be any different then the professional version for the basics.

I will have to look into this more and see what I can find.

Andy
Can you set things in your environment variables?
https://docs.microsoft.com/en-us/cpp/build/reference/cl-environment-variables?view=vs-2019

Messing with INCLUDE directly might be a bad idea, but CL and _CL_ seem fair game.
if its visual studio, I believe you can make a custom project startup so every project you start using that template would have your folder already added. Alternately you can make an empty project that is set up properly and clone it as a new one every time.

First step is to figure out how to add it to the project correctly so it works... it should work when added to include folders, and if not, something is not configured right but I do not know what it could be.
Last edited on
If you can't make a template the way jonnin suggests, then maybe it's possible to make a small dummy project that's setup the way you want it. When you start a new project, begin with a copy of the dummy project.

I have not tried this using the <>, but I f know it will work with the double quotes.
The difference between #include <> and #include "" is that <> will search the standard directories first, then any others specified by the project, command line, environment variables, etc.
ANSWER

You can, but you shouldn't.


See, Windows is not the same as Unix, and MS removed* the very functionality you are asking about because it was causing problems.**

*hid, but since VS2017 you can override global project defaults 
**causing problems == developers were misusing it


Solutions are:

1) Have yourself your master include folder. (Mine is C:\MSVC\include.)
Every time you start a new project, just add it. Easy peasy, takes two seconds.

Same with the master lib folder. (Mine is C:\MSVC\x64\lib for 64-bit stuff.)
That’s an additional two seconds.

2) Modify the global cpp project default template.
You will have to enable the Property Manager, open a project, then frob the various global build type XML sheets in your new Property Manager. Save your solution and click Yes if asked if you really want to save the property sheets.


Good luck!
Last edited on
Topic archived. No new replies allowed.