3

I am upgrading some legacy c++ code, to Visual Studio 2019, and am getting the "C4996" compiler error.

The "Disable Specific Warnings" build option is not working. I have confirmed that /wd"4996" is present in the command line. However, I still get the C4996 error, when I build. I followed these instructions

char temp[256] = { 0 };
char *upper = strupr(temp);

I expect the build error to go away, however it persists.

Here is a screenshot, of a sample project, exhibiting the error: enter image description here

Also, adding "#pragma warning(disable : 4996)" to the code, does eliminate the Warning/Error, as expected. However, this is not an ideal solution because of the large number of lines of code that would need to change. I am looking for a project wide solution, which to my knowledge "Disable Specific Warnings" should provide.

mauja
  • 55
  • 7
  • Why does the compiler output classify this as an error and not a warning? – quamrana Apr 23 '19 at 19:59
  • What makes you believe this is a warning? The compiler seems to believe it is only an error and likely on purpose. This may help silence it: https://stackoverflow.com/questions/20448102/why-does-visual-studio-2013-error-on-c4996 –  Apr 23 '19 at 20:53

1 Answers1

0

The problem was user error. I did not notice that the configurations were different for the property I was editing (Release), and the configuration I was building (Debug).

Setting "Disable Specific Warnings" in the proper configuration, works as expected.

mauja
  • 55
  • 7