I like having my warning level set at W4 but all new projects start at W3. Is there some way to change the default value for warning levels for new projects?
2 Answers
I don't know how to do it at the IDE but you cand always edit the new project templates at:
%PROGRAM_FILES%\Microsoft Visual Studio 9.0\Common7\IDE\ProjectTemplates\
If you're using the express version there could be a minor variation in the path:
%PROGRAM_FILES%\Microsoft Visual Studio 9.0\Common7\IDE\{Version}\ProjectTemplates\
Where {Version} is the express flavor you are using, VCSExpress, VBExpress, etc.
The templates are zip files, just edit the project changing:
<WarningLevel>3</WarningLevel>
to
<WarningLevel>4</WarningLevel>
-
What file types are the templates? Neither of those directories exist on my machine. Oct 4, 2008 at 0:57
-
I couldn't find any project templates or anything on my machine so I just searched in all the files for WarningLevel. I found common.js at
%\Microsoft Visual Studio 9.0\VC\VCWizards\1033
Searching in the file showed WarningLevel appeared in three places, lines 672, 699 and 3354. I simply changed the three lines reading
CLTool.WarningLevel = WarningLevel_3;
to
CLTool.WarningLevel = WarningLevel_4;
When I made a new project it was set at /w4. So this worked for me, won't guarantee it won't hose your machine.