views:

674

answers:

2

I'm working on a new development in C++, using MS Visual Studio 2005. For this, I need to add several new projects to my solution. I always set my warning level to 4, and turn on "treat warnings as errors" (project -> properties -> c++ -> general).

Is there a way for me to tell Visual Studio that this is my default so I don't have to do it for each new project I create?

+1  A: 

The only way, that I know, is to modify the wizard. This isn't as hard as it sounds.

Go to your Visual Studio directory. Open VC\VCWizards\1033 directory, and open the common.js file. Now, search for the function AddCommonConfig.

Now, to set the default warning level to 4, find the line "CLTool.WarningLevel = WarningLevel_3;" and change it to "CLTool.WarningLevel = WarningLevel_4;" (note: it is set twice for debug and release configurations, so make sure you change it for both.)

Now, to make it treat warnings as errors, add a line (for both configurations) "CLTool.WarnAsError = true;"

Note, however, that this will change these settings for all the default VC wizards (but you probably want that anyway.)

Paulius Maruška