It seems that this file has not been built yet .C代码无法编译
相信许多在学C的朋友都遇到了这个问题,无论多少次选“是”,还是会重复出现窗口:
It seems that this file has not been built yet .
在控制台里,也会有这样的提示:||=== Build file: "no target" in "no project" (compiler: unknown) ===|
这个问题的解答,很多人说是编译包没有配置好,其实不一定,下面我来举三种不同的情况和修复方法:
1.编译包安装不全或者未安装(windows下)
解决方案:
首先,下载合适版本的minGW,安装时尽可能都选上(不是很大)。装好之后打开,会看到这个界面:
选好缺失的包(最好gcc都都装了),右键,选择mark for installation
然后如图操作,一路确定后稍等即可安装好。
2.IDE配置问题(windows+codeblocks)
如图,点击auto-detect,然后确定。如果不行可手动配置路径,手动不行那就说明你没装,请返回上一种情况。如果配置好了还没解决问题,请看下一种情况。
3.文件设置问题(codeblocks)
就目前来看,codeblocks的文件至少有“project”和单独文件两种状态(其实还有其他的)。在文件创建的时候,会有相关的选项选择编译器,如这样操作可以查看当前文件的设置:
打开却发现无法修改任何选项,尤其是头文件,这会导致.c文件无法连接。
这种状态下的单个文件是不允许编译的,他们其实大多是用右键菜单创建的而不是new》file这种操作,所以很多选项都选了默认,也就是不编译。
想要更改也很简单,把它们加入到一个项目(project)中去即可。