C语言使用getch报错(error:C4996)
in C各种出错 with 0 comment
C语言使用getch报错(error:C4996)
in C各种出错 with 0 comment

错误 C4996 'getch': The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant


这个问题在VS2012之前是不会当成错误的,目前这个问题有两个解决方法:

1、添加预处理

项目->属性->配置属性->C/C+±>预处理器->预处理器定义->编辑中添加

_CRT_SECURE_NO_DEPRECATE

_CRT_NONSTDC_NO_DEPRECATE

2、更换函数

将getch()函数更换为_getch()函数即可

Responses