Friday, April 18, 2014

Remove (_CRT_SECURE_NO_WARNINGS) in Visual Studio

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.

No comments:

Post a Comment