21

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

#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

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/

I am using windows 8

Lightness Races in Orbit
  • 378,754
  • 76
  • 643
  • 1,055
BaidNation
  • 387
  • 1
  • 2
  • 10
  • 1
    Does your source file actually include those quotation marks? – OmnipotentEntity Jan 25 '13 at 03:06
  • I cannot piece together enough concrete details from this. Please use full sentences with full words, capital letters, verbatim code... Your code and compilation commands are all about C, but you tagged the question C++. What is going on here? – Lightness Races in Orbit Jan 25 '13 at 03:08
  • Duplicate? [Dev C in Windows 8: gcc Internal Error](http://stackoverflow.com/questions/12811762/dev-c-in-windows-8-gcc-internal-error) – Masked Man Jan 25 '13 at 03:12
  • Can you try to do it manually and tell me what the error is? gcc -o hello hello.c (or whatever your file is named) – phyrrus9 Aug 04 '13 at 12:09
  • If none works, You can try the new DEVC++ from here. https://www.bloodshed.net/ – Muhammad Ali Aug 03 '22 at 14:05

10 Answers10

19

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

James
  • 225
  • 2
  • 2
12

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

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

Ramesh
  • 392
  • 1
  • 12
  • 39
  • 3
    There are a number of better IDEs out there since the dark days of Bloodshed Dev-C++. Qt Creator (even for non-Qt projects!) is at the top of my list, followed by a good text editor + commandline. – rubenvb Mar 04 '13 at 11:12
  • This was a good answer to me, I was just trying to use a version that was not for my SO. Windows 10 working well with the newest versions. – giovannipds Mar 26 '21 at 23:52
2

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

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.exe Download 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.

Sunil Kumar
  • 6,112
  • 6
  • 36
  • 40
2

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

Now you will see a tab with gcc and make and the respective path to it.Edit the gcc and make path to use mingw32-c++.exe and mingw32-make.exe respectively.Now it will work.

The Answer

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

Dr.Topaz
  • 87
  • 2
  • 8
0

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
Mat
  • 202,337
  • 40
  • 393
  • 406
Mark
  • 23
  • 2
0

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

Sankumarsingh
  • 9,889
  • 11
  • 50
  • 74
0

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

Because I have no permission to write on my exe file.

Mogsdad
  • 44,709
  • 21
  • 151
  • 275
Amir
  • 1,638
  • 19
  • 26
0

After some investigation, and with Dr.Topaz's help, I have learned that you will want to confirm that the program set for g++ in the Compiler Options really does compile the source code. In my case, the C:\Dev-Cpp\bin\g++.exe program did not create an exe, but the C:\Dev-Cpp\bin\c++.exe program did. Either program appears to be intended to take the same arguments and options as GNU g++. I would love to find an actual doc on the Dev-C++ compiler programs, but I have not so far.

You can test the compiler program with a simple example like this:

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

Currently in 2021, the Dev-C++ site invites you to download either original Dev-C++ or a newer fork by a group named Embarcadero.

I decided to try the Embarcadero version and the experience was slightly better. The UI is still a tad dated, but the g++.exe program it came with was able to compile programs without issue. Again, take note of where the program is being installed, but in my case, the Embarcadero compiler programs were in C:\Program Files (x86)\Embarcadero\Dev-Cpp\TDM-GCC-64\bin.

Both original Dev-C++ and Embarcadero come with mingw-32 versions of the compiler programs that from what I see do work in a Git Bash console, with slight differences such as not recognizing a default locale when using the command std::cout.imbue(std::locale("")).

Spencer Williams
  • 821
  • 10
  • 20
0

I faced this similar error, and none of the solutions worked. so I tried to download the latest version from here, https://www.bloodshed.net/

thisone

I rerun the program. and everything is now working correctly.

Muhammad Ali
  • 956
  • 3
  • 15
  • 20
-2

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

Ayyash
  • 1