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

Juan Martinez picture Juan Martinez · Jun 2, 2013 · Viewed 776.4k times · Source

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.

Answer

user2548100 picture user2548100 · Dec 24, 2013

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.

enter image description here