visual-studiovisual-c++compiler-options

How do I set the compiler warning level for all projects in Visual Studio?


I am currently working on a software written in C++ that consists of 70+ projects in Visual Studio. I would like to increase the compiler level for all those projects without clicking through 70+ project property windows to set the new value for the compiler warning level.

Is there any way to quickly set the compiler warning level for all projects in a Visual Studio solution?


Solution

  • Select all projects, then click on properties. It will open properties page. Here select "All Configurations" and "All Platforms". Then set appropriate warning levels, which will apply to all projects/configurations/platforms.

    You may de-select any config/platform, and apply the warning level for all projects. Consider hitting "Configuration Manager..." button on right.

    If you are willing to edit the .VCXProj - do that! It will be fastest, but please backup all of them.

    Another approach is to have a common header file, and place:

    #pragma warning(error:<warning-number>)
    

    This allows you to have more finer control to all warnings. But, you'd need to write almost all of them in header. But, you can configure for different builds.