19

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

#include <stdio.h>    
int main()
{
  printf("Hello world");
  getch();
}

我将其保存为 .c 文件。当我编译它工作正常,但当我编译并运行它说源文件未编译。所以我用谷歌搜索了一些东西,并在 youtube 上看到了这个视频,它向你展示了如何修复它。我还看到谷歌上的其他论坛建议同样的事情......但是,在做了什么之后,现在我什至无法编译我的代码。我收到这个错误

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 <URL:http://www.mingw.org/bugs.shtml> for instructions.

Execution terminated

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

我正在使用 Windows 8

4

9 回答 9

19

我遇到了这个问题并通过以下方式修复它: C:\Dev-Cpp\libexec\gcc\mingw32\3.4.2 ,然后删除 collect2.exe

于 2014-10-19T18:18:03.353 回答
10

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

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

于 2013-03-04T11:05:16.450 回答
2

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

现在您将看到一个选项卡,其中包含gccandmake和相应的路径。分别编辑gccmake使用mingw32-c++.exeand的路径mingw32-make.exe。现在它可以工作了。

答案

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

于 2017-07-23T05:41:25.163 回答
1

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

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

于 2014-04-02T06:16:12.057 回答
0

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

  1. 右键单击我的组合。图标

  2. 单击高级设置。

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

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

  5. 点击确定

于 2013-11-25T08:56:53.463 回答
0

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

gcc filename.c -o filename
于 2013-01-25T03:13:00.200 回答
0

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

例如我收到

cannot open output file Project1.exe: Permission denied
collect2.exe: error: ld returned 1 exit status

mingw32-make.exe: *** [Project1.exe] Error 1

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

于 2015-11-03T21:43:34.323 回答
0

经过一番调查,并在 Dr.Topaz 的帮助下,我了解到您需要确认g++在编译器选项中设置的程序确实编译了源代码。就我而言,该C:\Dev-Cpp\bin\g++.exe程序没有创建一个 exe,但该C:\Dev-Cpp\bin\c++.exe程序创建了。这两个程序似乎都打算采用与GNU g++相同的参数和选项。我很想找到有关 Dev-C++ 编译器程序的实际文档,但到目前为止还没有。

您可以使用如下简单示例测试编译器程序:

C:\Dev-Cpp\bin\c++.exe hello.cpp -o hello.exe

目前在 2021 年,Dev-C++站点邀请您下载原始的 Dev-C++ 或名为 Embarcadero 的组的新分支。

我决定尝试 Embarcadero 版本,体验稍好一些。用户界面仍然有点过时,但g++.exe它附带的程序能够毫无问题地编译程序。再次注意程序的安装位置,但就我而言,Embarcadero 编译器程序位于C:\Program Files (x86)\Embarcadero\Dev-Cpp\TDM-GCC-64\bin.

原始的 Dev-C++ 和 Embarcadero 都带有 mingw-32 版本的编译器程序,据我所见,它们在 Git Bash 控制台中工作,略有不同,例如在使用 command 时无法识别默认语言环境std::cout.imbue(std::locale(""))

于 2021-07-10T23:05:12.293 回答
-1

I was facing the same issue as described above.

It can be resolved by creating a new project and creating a new file in that project. Save the file and then try to build and run.

Hope that helps. :)

于 2013-12-02T08:53:15.827 回答