firemail

标题: error C4996: 'strdup': The POSIX name for this item is deprecated. Instead, u... [打印本页]

作者: Qter    时间: 2020-1-18 23:18
标题: error C4996: 'strdup': The POSIX name for this item is deprecated. Instead, u...
本帖最后由 Qter 于 2020-1-18 23:29 编辑

error C4996: 'strdup': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strdup. See online help for details.

原因:

新版本的vs对旧有的函数strdup进行了安全检查,所以使用新版本的vs会提示错误,而旧版本的没问题。

解决办法:

1、使用新函数 _strdup

2、如果非要使用旧函数也是可以的,加上宏定义即可

#define _CRT_NONSTDC_NO_DEPRECATE
#define _CRT_SECURE_NO_WARNINGS
———————————————


或进行如下设置









欢迎光临 firemail (http://firemail.wang:8088/) Powered by Discuz! X3