vs2015使用mkdir创建文件夹时遇到错误

0.环境

windows10
vs2015专业版

1.demo程序

#include <iostream>
#include <direct.h>
#include <io.h>

char imagePath[200] = "E:\\project\\05_22\\";
char savePath[200] = "E:/c++work/20190801/";
int main()
{
	if (0 != access(string(imagePath).c_str(), 0))
	{
		// if this folder not exist, create a new one.
		mkdir(string(imagePath).c_str());   // 返回 0 表示创建成功,-1 表示失败

	}
	if (0 != access(string(savePath).c_str(), 0))
	{
		// if this folder not exist, create a new one.
		mkdir(string(savePath).c_str());   // 返回 0 表示创建成功,-1 表示失败

	}
    
    return 0;

}

2.遇到的问题

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

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

3.解决

将这句” _CRT_NONSTDC_NO_DEPRECATE“,”_CRT_SECURE_NO_WARNINGS“, 添加到工程属性 -》配置属性 -》c/c++ -》预处理器 -》预处理器定义中:

4.参考

1.VS2015编译问题:The POSIX name for this item is deprecated. Instead, use the ISO C

 

 

  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

wait a minutes

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值