locked
How to get rid of this warning! RRS feed

  • Question

  • Hi,

    Can anyone show me how to get rid of this warning:

    >c:\_flash\2_development\1_apps\bmc\bmc_project\bmc_176x186\bmc.cpp(186) : warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.

    What is _CRT_SECURE_NO_WARNINGS and where can I find it?

    Regards

    Rob

     

    Tuesday, September 14, 2010 8:37 PM

Answers


  • >c:\_flash\2_development\1_apps\bmc\bmc_project\bmc_176x186\bmc.cpp(186) : warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.

    I think when they said, "See online help for details.", they meant the MSDN Library , not these forums.
    When they say define something you can use the #define directive in your source file, or you can use the project Properties -> Configuration Properties -> C/C++ -> Preprocessor -> Preprocessor Definitions (info here ).
    • Proposed as answer by ildjarn Tuesday, September 14, 2010 9:28 PM
    • Marked as answer by Yi Feng Li Tuesday, September 21, 2010 2:49 AM
    Tuesday, September 14, 2010 9:01 PM
  • Either add _CRT_SECURE_NO_WARNINGS per Fredrick's instructions or use fopen_s.  If you are writing code that must be portable, use _CRT_SECURE_NO_WARNINGS, as that is a Microsoft extension.

    • Proposed as answer by Yi Feng Li Thursday, September 16, 2010 2:07 AM
    • Marked as answer by Yi Feng Li Tuesday, September 21, 2010 2:49 AM
    Tuesday, September 14, 2010 9:13 PM

All replies


  • >c:\_flash\2_development\1_apps\bmc\bmc_project\bmc_176x186\bmc.cpp(186) : warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.

    I think when they said, "See online help for details.", they meant the MSDN Library , not these forums.
    When they say define something you can use the #define directive in your source file, or you can use the project Properties -> Configuration Properties -> C/C++ -> Preprocessor -> Preprocessor Definitions (info here ).
    • Proposed as answer by ildjarn Tuesday, September 14, 2010 9:28 PM
    • Marked as answer by Yi Feng Li Tuesday, September 21, 2010 2:49 AM
    Tuesday, September 14, 2010 9:01 PM
  • Either add _CRT_SECURE_NO_WARNINGS per Fredrick's instructions or use fopen_s.  If you are writing code that must be portable, use _CRT_SECURE_NO_WARNINGS, as that is a Microsoft extension.

    • Proposed as answer by Yi Feng Li Thursday, September 16, 2010 2:07 AM
    • Marked as answer by Yi Feng Li Tuesday, September 21, 2010 2:49 AM
    Tuesday, September 14, 2010 9:13 PM