C语言 未编译的源文件 Dev C++

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14514682/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 05:08:43  来源:igfitidea点击:

Source file not compiled Dev C++

cdev-c++

提问by BaidNation

I just installed Dev C++ and I am learning C programming. the code i used was

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

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

I saved it as a .c file. When I compile it works fine, but when I compile and run it says source file not compiled. So I googled buncha things and came across this video on youtube which shows you how to fix it. I also saw other forums on google which suggest the same thing... However, after doing whats asked, Now I can't even compile my code. I get this error

我将其另存为 .c 文件。当我编译时它工作正常,但是当我编译并运行它时,它说未编译源文件。所以我在 google 上搜索了一些东西,并在 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

I have also used what is asked on this link, and still no luck.. http://learntogeek.com/miscellaneous/solved-source-file-not-compiled-error-in-dev-cpp/

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

I am using windows 8

我正在使用 Windows 8

回答by James

I was having this issue and fixed it by going to: C:\Dev-Cpp\libexec\gcc\mingw32\3.4.2 , then deleting collect2.exe

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

回答by Ramesh

Install new version of Dev c++. It works fine in Windows 8. It also supports 64 bit version.

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

Download link is http://sourceforge.net/projects/orwelldevcpp/.

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

回答by Sunil Kumar

I guess you're using windows 7 with the Orwell Dev CPP

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

This version of Dev CPP is good for windows 8 only. However on Windows 7 you need the older version of it which is devcpp-4.9.9.2_setup.exeDownload it from the link and use it. (Don't forget to uninstall any other version already installed on your pc) Also note that the older version does not work with windows 8.

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

回答by Dr.Topaz

This maybe because the c compiler is designed to work in linux.I had this problem too and to fix it go to toolsand select compiler options.In the box click on programs

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

Now you will see a tab with gccand makeand the respective path to it.Edit the gccand makepath to use mingw32-c++.exeand mingw32-make.exerespectively.Now it will work.

现在你会看到一个标签gcc,并make和it.Edit了各自的路径gccmake道路使用mingw32-c++.exemingw32-make.exerespectively.Now它会奏效。

The Answer

答案

The reason was that you were using compilers built for linux.

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

回答by Amir

This error occurred because your settings are not correct.

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

For example I receive

例如我收到

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

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

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

Because I have no permission to write on my exefile.

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

回答by user3030672

I found a solution. Please follow the following steps:

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

  1. Right Click the My comp. Icon

  2. Click Advanced Setting.

  3. CLick Environment Variable. On the top part of Environment Variable Click New

  4. Set Variable name as: PATH then Set Variable Value as: (" the location of g++ .exe" ) For ex. C:\Program Files (x86)\Dev-Cpp\MinGW64\bin

  5. Click OK

  1. 右键单击我的comp。图标

  2. 单击高级设置。

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

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

  5. 单击确定

回答by Ayyash

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. :)

希望有帮助。:)

回答by Mark

You can always try doing it manually from the command prompt. Navigate to the path of the file and type:

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

gcc filename.c -o filename