Remove secure warnings (_CRT_SECURE_NO_WARNINGS) from projects by default in Visual Studio
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.
It may have been because I am still new to VS and definitely new to C, but the only thing that allowed me to build was adding
#pragma warning(disable:4996)
At the top of my file, this suppressed the C4996 error I was getting with sprintf
A bit annoying but perfect for my tiny bit of code and by far the easiest.
I read about it here: https://msdn.microsoft.com/en-us/library/2c8f766e.aspx
Not automatically, no. You can create a project template as BlueWandered suggested or create a custom property sheet that you can use for your current and all future projects.
- Open up the Property Manager (View->Property Manager)
- In the Property Manager Right click on your project and select "Add New Project Property Sheet"
- Give it a name and create it in a common directory. The property sheet will be added to all build targets.
- Right click on the new property sheet and select "Properties". This will open up the properties and allow you to change the settings just like you would if you were editing them for a project.
- Go into "Common Properties->C/C++->Preprocessor"
- Edit the setting "Preprocessor Definitions" and add
_CRT_SECURE_NO_WARNINGS
. - Save and you're done.
Now any time you create a new project, add this property sheet like so...
- Open up the Property Manager (View->Property Manager)
- In the Property Manager Right click on your project and select "Add Existing Project Property Sheet"
The benefit here is that not only do you get a single place to manage common settings but anytime you change the settings they get propagated to ALL projects that use it. This is handy if you have a lot of settings like _CRT_SECURE_NO_WARNINGS
or libraries like Boost that you want to use in your projects.