29

I've got an error trying to compile my curve compression program, error no C4996, function call with parameters may be unsafe. It's telling me to use the above. The error is coming from xutility header file, which I've never laid eyes on before. is this a flag I have to input into a console? There is literally no reference to it online...

Robbie Cooper
  • 483
  • 2
  • 5
  • 13
  • It's a macro definition. – David G Jul 30 '14 at 21:02
  • thanks! Weird, I literally copied and pasted it into google and no results came up. Sorry... – Robbie Cooper Jul 30 '14 at 21:04
  • 18
    "There is literally no reference to it online..." - Did you do a Google search for exactly `-D_SCL_SECURE_NO_WARNINGS`? If so, that explains why you didn't find anything. You didn't specify any search terms, you merely specified that they must *not* contain `D_SCL_SECURE_NO_WARNINGS`. That's what `-` normally means to Google. Either remove the `-` or put the whole thing in quotes, and you'll get plenty of results. –  Jul 30 '14 at 21:05

4 Answers4

64

-D is a command line compiler flag which causes the rest of the text to be treated as if there was a #define in your code.

In solution explorer, right click the project, select "properties". The project property page will open. Expand the ">C/C++" entry in the tree on the left and select "Preprocessor" under that. The top entry in the right pane should be "Preprocessor Definitions". In that edit box, add _SCL_SECURE_NO_WARNINGS, separating it from the other entries with a ;

F. P.
  • 5,018
  • 10
  • 55
  • 80
Rob K
  • 8,757
  • 2
  • 32
  • 36
11

I'd like to also add that if you want to use

#define _SCL_SECURE_NO_WARNINGS

directly in your code, you have to place it before including headers. Or you can use

#pragma warning(disable:4996)
Meyer
  • 1,662
  • 7
  • 21
  • 20
Kaaf
  • 350
  • 5
  • 10
4

-D means "define a macro", in this case _SCL_SECURE_NO_WARNINGS. Which mean somewhere in the code there's a

#if defined(_SCL_SECURE_NO_WARNINGS)

line. If you want to do this from inside VS, go to the project's properties page, and under one fo the tabs there should be a spot to add new defines. There should already be some listed (like DEBUG). Add _SCL_SECURE_NO_WARNINGS there.

James Curran
  • 101,701
  • 37
  • 181
  • 258
0

-D is compiler flag or a macro like you were defined in your source code.

-D_SCL_SECURE_NO_WARNINGS defines _SCL_SECURE_NO_WARNINGS macro.

Please look at below link for more details on _SCL_SECURE_NO_WARNINGS macro. https://devblogs.microsoft.com/cppblog/why-am-i-getting-these-_scl_secure_no_warnings-messages/

Andy
  • 338
  • 3
  • 10