codeblocks(自带编译器的zip版)下载

操作系统:Windows10。编译器是MingW(gcc的windows实现)。

①下载

进入Binary releases - Code::Blocks

下载.zip解压后 点击CbLauncher.exe 就打开了。

②设置C++11.  setting -> compiler

运行

③设置运行快捷键 setting -> editor 。添加快捷键时需要敲击你想要的键盘按键

④调出底端界面(运行报错信息在此)View -> perspective -> default 或者 delete current。

 ⑤测试(遍历某文件夹下的文件,Linux和Windows上通用;io.h的方式只能用于Windows)

#include <sys/types.h>
#include <dirent.h>
#include <stdio.h>

#include <iostream>
using namespace std;
int main(int argc,char *argv[])
{

	DIR *dp;
	struct dirent *dirp;
	int n=0;
	if((dp=opendir("C:\\Users\\"))==NULL)
		printf("can't open the dir !");
    cout << "Your dir must include two d_name, it`s '.' and '..'" << std::endl;
	while (((dirp=readdir(dp))!=NULL) && (n<=450))
	{
		n++;
		printf("%-6d%s\n", n, dirp->d_name);
	}
	printf("\n");
	closedir(dp);

	return 0;
}

io.h遍历的方式在Linux平台上 一般不能正常编译,报错为【fatal error: io.h: No such file or Directory #include <io.h>

  • 2
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值