源文件未编译Dev C ++

我刚刚安装了Dev C ++,我正在学习C编程。 我使用的代码是

#include  int main() { printf("Hello world"); getch(); } 

我把它保存为.c文件。 当我编译它工作正常,但当我编译并运行它说源文件没有编译。 所以我用google搜索buncha的东西,在youtube上看到了这个video,告诉你如何修复它。 我还看到谷歌上的其他论坛建议同样的事情……然而,在做了什么之后问,现在我甚至无法编译我的代码。 我收到这个错误

 Compiler: Default compiler Executing C:\Dev-Cpp\bin\gcc.exe... C:\Dev-Cpp\bin\gcc.exe "C:\Users\ubaid\Documents\C\Untitled1.c" -o "C:\Users\ubaid\Documents\C\Untitled1.exe" -I"C:\Dev-Cpp\include" -L"C:\Dev-Cpp\lib" gcc.exe: Internal error: Aborted (program collect2) Please submit a full bug report. See  for instructions. Execution terminated 

我也用过这个链接上的问题,但仍然没有运气.. http://learntogeek.com/miscellaneous/solved-source-file-not-compiled-error-in-dev-cpp/

我正在使用Windows 8

我有这个问题并通过转到:C:\ Dev-Cpp \ libexec \ gcc \ mingw32 \ 3.4.2修复它,然后删除collect2.exe

安装新版本的Dev c ++。 它在Windows 8中运行良好。它还支持64位版本。

下载链接是http://sourceforge.net/projects/orwelldevcpp/ 。

我猜你正在使用带有Orwell Dev CPP的 Windows 7

此版本的Dev CPP仅适用于Windows 8。 但是在Windows 7上,您需要它的旧版本devcpp-4.9.9.2_setup.exe从链接下载并使用它。 (不要忘记卸载PC上已安装的任何其他版本)另请注意,旧版本不适用于Windows 8。

您始终可以尝试从命令提示符手动执行此操作。 导航到文件的路径并键入:

 gcc filename.c -o filename 

我找到了解决方案。 请按照以下步骤操作:

  1. 右键单击My comp。 图标

  2. 单击高级设置。

  3. CLick环境变量。 在环境变量的顶部单击“新建”

  4. 将变量名称设置为:PATH然后将变量值设置为:(“g ++ .exe的位置”)例如。 C:\ Program Files(x86)\ Dev-Cpp \ MinGW64 \ bin

  5. 单击确定

我面临着与上述相同的问题。

可以通过创建新项目并在该项目中创建新文件来解决此问题。 保存文件,然后尝试构建并运行。

希望有所帮助。 🙂

发生此错误是因为您的设置不正确。

比如我收到了

 cannot open output file Project1.exe: Permission denied collect2.exe: error: ld returned 1 exit status mingw32-make.exe: *** [Project1.exe] Error 1 

因为我没有权限写我的exe文件。

这可能是因为c编译器被设计为在linux中工作。我也有这个问题并修复它去tools并选择compiler options 。在框中点击programs

现在你将看到一个带有gccmake的选项卡以及它的相应路径。编辑gcc make路径分别使用mingw32-c++.exemingw32-make.exe 。现在它可以工作了。

答案

原因是你使用的是为linux构建的编译器。

 #include  int main() { printf("Hello world"); getch(); return 0; } 

在devc ++中使用int main时必须使用return 0