警告;编译中出现 This function or variable may be unsafe.

来源:互联网 发布:xp限制安装软件 编辑:程序博客网 时间:2024/04/30 12:14
1. 编译中出现如下语句:

This function or variable may be unsafe. 

Consider using strncpy_s instead. 

To disable deprecation, use _CRT_SECURE_NO_WARNINGS

See online help for details.

在文件开头添加:#define  _CRT_SECURE_NO_WARNINGS
错误会消失。
2. vs中可以
      1. Properties-----> Common Properties-----> C/C++ ------> Preprocessor
            1. Preprocessor Definitions -----> 添加
            1. _CRT_SECURE_NO_WARNINGS
            2. 参考资料:
            3. http://stackoverflow.com/questions/16883037/remove-secure-warnings-crt-secure-no-warnings-from-projects-by-default-in-vis

            4. http://stackoverflow.com/questions/22450423/how-to-use-use-crt-secure-no-warnings

            5. http://stackoverflow.com/questions/22450423/how-to-use-use-crt-secure-no-warnings
0 0