Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2015 won't suppress error C4996

Visual Studio 2015 Community Edition gives the following error when compiling in debug, but not when compiling in release:

std::copy::_Unchecked_iterators::_Deprecate': Call to 'std::copy' with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators'

I was able to trace back the source of this error to lines 214 and 242 of this third party library I'm using to write bitmap images. I don't fully understand what is going on in these parts, so I'd rather not mess with it.


I'm trying to disable this error, but Visual Studio won't let me. I've tried the following solutions that were suggested in the documentation, on StackOverflow, or elsewhere:

  • Add 4996 to the "Disable Specific Warnings" field in Project Settings > Configuration Properties > C/C++ > Advanced.
  • Add /wd4996 to the "Command Arguments" field in Project Settings > Configuration Properties > Debugging.
  • Add #pragma warning (disable : 4996) at the top of the offending file, and/or above the offending function.
  • Add _SCL_SECURE_NO_WARNINGS, _SCL_NONSTDC_NO_WARNINGS, _SCL_OBSOLETE_NO_WARNINGS, _SCL_SECURE_NO_WARNINGS_GLOBAL, and combinations thereof to the "Preprocessor Definitions" field in Project Settings > Configuration Properties > C/C++ > Preprocessor.
  • Add the definitions from the previous solution with a #define directive to the top of the offending file.
  • Add the definitions from the previous solution but prefixed with /D or with -D to the "Command Arguments" field.

But none of this fixes the issue for me.


What could possibly be the reason for Visual Studio to keep insisting on displaying this error?

like image 610
FWDekker Avatar asked Jun 27 '16 18:06

FWDekker


1 Answers

define NO_WARN_MBCS_MFC_DEPRECATION

like image 156
AnEnglishmanInNorway Avatar answered Oct 13 '22 03:10

AnEnglishmanInNorway