none
How do I disable deprecation in VC++ Express Edition?

    Question

  • Hi everyone,

    How do you disable the deprecation check in VC++ Express Edition?

    Below is what I'm trying to do:

    Code Snippet

    warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.


    How/where do I use _CRT_SECURE_NO_WARNINGS ?

    I'm looking into using strcpy_s at the moment, but I would like to know the method to disable the warning, just to learn.

    Thanks in advance!!

    Kurt
    Friday, July 27, 2007 10:43 PM

Answers

  • Allways happy to help a fellow wrestler...

    Project properties->Configuration Properties->C/C++->Preprocessor->Preprocessor Definitions

    Click on the elipses (...)
    type any definitions you like separated by "\n"ie

    _CRT_SECURE_NO_WARNINGS

    hit OK.
    enjoy the silence...

    Robin
    Sunday, July 29, 2007 2:54 AM

All replies

  • Allways happy to help a fellow wrestler...

    Project properties->Configuration Properties->C/C++->Preprocessor->Preprocessor Definitions

    Click on the elipses (...)
    type any definitions you like separated by "\n"ie

    _CRT_SECURE_NO_WARNINGS

    hit OK.
    enjoy the silence...

    Robin
    Sunday, July 29, 2007 2:54 AM
  • Cool!

    Thanks, Robin Smile
    Sunday, July 29, 2007 5:34 AM
  • By the way, to disable for just one file put this line before the line that causes the warning

    #define _CRT_SECURE_NO_WARNINGS

     

    If you want to turn off the POSIX deprecated warnings, put this line, too

    #define _CRT_NONSTDC_NO_WARNINGS

    And, of course, you can put these lines in a header file, such as "Warnings.h" and include at the top of files which you do not want those warnings:
    #include "Warnings.h"


    Ron Lewis at Indinfer, Baltimore, Maryland, United States
    Sunday, January 01, 2012 8:07 PM
  • Use

    #pragma warning(disable: 4996)

    Fabio Menezes

    Tuesday, March 27, 2012 10:20 PM
  • Thanks it work for me !

    Suresh Dinde

    Sunday, March 10, 2013 1:25 AM
  • Thanks a lot.it works well!!
    Tuesday, July 16, 2013 12:21 PM