VS2012 and Additional Inclue Directories

Started by
5 comments, last by too_many_stars 6 years, 2 months ago

Hello Everyone,

A quick question regarding Visual Studio 2012.

Under Configuration Properties, we have VC++ Directories -> Include Directories

Under C/C++ we have General->Additional Include Directories

What exactly is the difference and when should I be using the C/C++ Additional Include Directories?

 

Thanks,

Mike

Advertisement

The VC++ Directories -> Include Directories corresponds to the environment variable INCLUDE in windows. This can be thought of as a global variable that is applicable to all solutions on that Windows PC.

C/C++  General->Additional Include Directories applies to the project level only.  This is the one you should use the most, because it is the setting that is persistent when porting your project onto a different PC.  However, this often means you have to set it for each project.

Also, why are you using 2012? There's no reason to use that over 2017.

if you think programming is like sex, you probably haven't done much of either.-------------- - capn_midnight

@desiado - Thanks, I think I understand. So every solution on my PC will be able to see what's in one VC++ Directories -> Include Directories as opposed to project level only.

 

@ChaosEngine - It's an old laptop and I have not bothered updating. However, as soon as I get something newer, that will be the first thing I do.

 

Thanks so much guys!

On ‎14‎/‎02‎/‎2018 at 5:39 PM, too_many_stars said:

So every solution on my PC will be able to see what's in one VC++ Directories -> Include Directories as opposed to project level only

Yes and no.  The VC++ directories for your project will get populated with the global value on creation.  You can edit it, but if you want this edit to be persistent across all projects on your PC, then you need to edit the VC++directories in your user property sheet and not in the project properties window.
 
To explain further, the VC++ directories is a confusing setting now because it dates back to when it was a global setting in the visual studio IDE i.e. in VS2008 and earlier it was accessed from the top tools bar, Tools ->Options.  Since VS 2010 you can now override this global setting on a per project basis in the project properties window.  At the same time it was also removed from the top tools bar.  Now this ability to override the global settings on a per project basis, although useful, is confusing because:-
a) To now edit the VC++ directories on a global basis on your PC, you need to edit your user property sheet.
b) VC++ directories in the project properties window now shares similar abilities as the 'Additional include directories'.  Hence your confusion.
 
I think Brian Tyler explains it better here in his blog
 
and also worth looking at how user property sheets work in VS
 
Now that said, to decide which of the two include settings to use. I think in general it is simplest to use them as they were originally designed for. That is, the VC++ directories should be treated as global paths to directories that will apply to all solutions on your PC like the VC include paths and major SDKs like the Windows SDK.  Your project will automatically be set to these defaults on creation and only change this if you wish to override the default settings.  For additional includes, you should use the additional includes setting, like if you need to add includes from your other projects or third party includes and anything that only applies to the local solution (game) you are working on.

Thank you very much for the detailed response. I will have a look at both links.

 

Mike

This topic is closed to new replies.

Advertisement