Remove secure warnings (_CRT_SECURE_NO_WARNINGS) from projects by default in Visual Studio

c++, precompiler, visual-studio

Solution

Mark all the desired projects in solution explorer.

- Press Alt-F7 or right click in solution explorer and select "Properties"

- Configurations: All Configurations

- Click on the Preprocessor Definitions line to invoke its editor

- Choose Edit

- Copy `_CRT_SECURE_NO_WARNINGS` into the Preprocessor Definitions white box on the top

Problem

Is there a way to set by default for all projects removing the precompiler secure warnings that come up when using functions like scanf(). I found that you can do it by adding a line in the project option or a `#define _CRT_SECURE_NO_WARNINGS` in the beginning of the code. I find myself repeatedly creating new projects for solving programming contests and it is really annoying (and takes valuable time) to add: ``` #ifdef _MSC_VER #define _CRT_SECURE_NO_WARNINGS #endif ``` In the beginning of the code, or to set it in the precompiler options every time I start a new project.

Original source

Related problems