Skip to content

MinGW bugs under Windows Vista

October 19, 2007

(Edit: 1 November 2007)
Found out this is a bug of MinGW, and has nothing to do with Dev-C++.

Recently I installed Dev-C++ under Windows Vista, but when I try to compile the template DLL, it gives the following error in compile log.

gcc.exe: installation problem, cannot exec `cc1′: No such file or directory

In Dev-C++, go to Tools -> Compiler Options -> Directories -> Binaries, add this following directory

Compile the project again. Okay, now what?

ld: crt2.o: No such file: No such file or directory
ld: dllcrt2.o: No such file: No such file or directory
ld: crtbegin.o: No such file: No such file or directory
ld: crtend.o: No such file: No such file or directory
ld: cannot find -lgcc

(Update: 1 November 2007)
To workaround this errors, you need to do the following steps:

  1. Copy dllcrt2.o and crt2.o from \Dev-Cpp\lib to \MinGW\lib.
  2. Copy crtbegin.o and crtend.o from \Dev-Cpp\lib\gcc\mingw32\3.4.2 (version may vary depending on your mingw version) to \MinGW\lib.
  3. In Dev-C++, go to Tools -> Compiler Options -> Directories -> Libraries, add this following directory
    (again, version may vary depending on your mingw version)

Compile your project, it should work now. Now I try to compile the C version, oh no more errors.

In file included from dllmain.c:3:
C:/Dev-Cpp/include/windows.h:47:20: stdarg.h: No such file or directory
In file included from C:/Dev-Cpp/include/winnt.h:37,
from C:/Dev-Cpp/include/windef.h:253,
from C:/Dev-Cpp/include/windows.h:48,
from dllmain.c:3:
C:/Dev-Cpp/include/string.h:24:20: stddef.h: No such file or directory
In file included from C:/Dev-Cpp/include/winnt.h:37,
from C:/Dev-Cpp/include/windef.h:253,
from C:/Dev-Cpp/include/windows.h:48,
from dllmain.c:3:

blah blah blah

Here’s the fix. In Dev-C++, go to Tools -> Compiler Options -> Directories -> C Includes, add this directory
(I dont want to repeat that again)

Okay now everything is working. Hopefully these should solve your problem regarding compiling with Dev-C++ under Windows Vista.


From → C++, Coding

  1. 0xman permalink

    Thank you , very useful !

  2. NeWZzZzzz permalink

    Useful, but it’s so tedious to paste those 3 files everytime…

  3. Well, I cant find any other workaround. It seems to be a bug of Dev-C++, and too bad the project been inactive, so bear with it.

  4. Omniyo permalink

    Muchas gracias…i’m a spanish studient & i couldn’t find how to run dev-c++ under windows vista…thank you again!!!

  5. Okay so I found a better workaround. You no longer need to copy crt2.o and dllcrt2.o to your project folder each time. Read up the updated post.

  6. Christoffer permalink

    What a relief!

    finally after several hours of reading obscure posts in even more obscure forums, reading through a good portion of the gnu gcc manual and hitting my head against the desk, i stumble upon this solution. Funny that I did’nt even realize it was a bug.

    Thank you very much!

  7. Martin permalink


    I got the “dllcrt2.o” error in two cases, and could resolve it as follows:

    First I tried to link a DLL written in C. The error was gone after I added the directory containing sh.exe to Compiler Options/Directories/Binaries.

    But it came back when I then tried to link a C++ DLL. To fix this, I checked “Add these commands to the linker command line” in Compiler Options/Compiler and entered the following line:
    -B E:/Programme/MinGW/lib -B E:/Programme/MinGW/lib/gcc/mingw32/3.4.5

    (Now you know I’m German.) Of course, you’ll have to replace E:/Programme/MinGW with your path to MinGW.

    The second path is necessary for some other files such as crtbegin.o. BTW, I cleared Compiler Options/Directories/Libraries afterwards, and it still worked.

    About how I found this:

    I used SysInternals’ Process Monitor to find out what the compiler/linker was doing and where it was searching the files. It seems that the error occurs whenever the command line for gcc.exe looks like:
    gcc …
    instead of:
    E:/Programme/MinGW/bin/gcc.exe …
    The same applies to c++.exe.

    That is, given its own location on the command line, gcc.exe/c++.exe seems to know better where to search for the required files.

    For the C DLL before the fix, the commands used were:
    cmd (with a batch file)

    (mingw32-make called cmd, cmd called dllwrap,…)

    After I added the MSYS bin directory in Dev-C++, sh.exe became visible to mingw32-make, and the commands changed to:

    That worked with the C DLL. But for the C++ case, dllwrap was called with the option:
    –driver-name c++
    Consequently, it the commands were:

    I could not find any way to change this to a full path (E:/Programme/MinGW/bin/c++.exe) except hacking the that Dev-C++ had generated, which obviously isn’t very convenient.

    So I looked at “c++ –help”, found the -B option and used it as shown above. (It also works for gcc.exe.) Things can be so easy.
    I could now probably even let cmd be used again, but I feel better with sh.

    Finally, a little about my configuration, in case it matters:

    I have Vista 32-bit Home Premium, Dev-C++, MSYS 1.0.10 and the “Current” releases of the MinGW packages (gcc 3.4.5) installed.

    I’m using mingw32-make.exe with that name (no make.exe).

    Note that I did not add MinGW to PATH, but configured the paths in Compiler Options/Directories/Binaries.

    Have a nice day!

  8. Markus Bussmann permalink

    Very useful, as I have a class of students installing Dev-C++ on Windows, and the Vista users are suffering.

    One question. My install doesn’t include \MingW, because I installed the Dev-C++ that includes MingW. Which means I can’t copy crt2.o, dllcrt2.o, crtbegin.o and crtend.o as you describe in your update of Nov 1.


  9. If there isnt one, create one. 🙂 You just have to copy the 3 files described above to the new folder.

  10. zlucoblij permalink

    Guys, thanks a million for usefull pieces of advice. Finally have Dev-Cpp compiling on Vista!!! Can’t belive my eyes 😀


  11. You’re welcome. 🙂 Glad it helped.

  12. ghazali permalink

    im use Dev c++ in vista home premium edtion.when i try to compile the program that i wrote, source not compiled is appear. im already save the program that i write..but still cannot compiled.. can you help me?

  13. Fro permalink

    Someone should make a .bat file and put it up. It would be a good fix. You could even make an .exe if you could be bothered.

  14. Peter permalink

    I copied the files crt2.0, dllcrt2.0, crtbegin.0 and crtend.0 to the project folder path. And now I only get the error message cannot find -lgcc. Any ideas how to fix this?


  15. Peter permalink

    Its ok, I got it working now.

    Under Tools > Compiler Options > Directories > Binaries and Libraries, I needed to add:

    Thanks a million. That was great!


  16. Pedro permalink

    Tnks a lot, this post helped me so much!!!

  17. David permalink

    I got it working, but i still have to copy “crt2.o” , “crtbegin.o”, “crtend.o” and “dllcrt2.o” to the project folder. any ideas?

  18. Fabio permalink

    Thanks, Martin. The -B option worked in Eclipse CDT (Mingw[32] and Vista 64).

  19. Zach permalink

    I am still stuck with the “ld: crt2.o: No such file: No such file or directory” error, even after doing everything you said to. I didn’t have a C:\Dev-Cpp\MingW\lib folder, so I made one and put the files there, and I also put them in C:\Dev-Cpp\mingw32\lib, which already existed. I don’t know what to do at this point. I have an old computer sitting around that I can format and throw xp onto, but that would be the epitome of annoying. I think I’m gonna write an angry letter to Microsoft: “Vista WTF??? ‘Nuff Said.” I mean seriously, WTF is wrong with Vista? Have they never heard of backwards compatibility? I have to submit working .exe’s for an online class I’m taking in C. I’m already well versed in Java, so I figured I’d make the jump (77th in Texas for highschool java programmers w00t).

  20. Zach permalink

    Nevermind, I figured it out

  21. Weslei A. de T. Marinho permalink

    An easier workaround may be found in
    But thanks for sharing your knowledgement.

    Best regards.

  22. Aaron permalink

    Wow! It worked! Thank-you!!

  23. Jhon Mnemonik permalink

    Cool man! Great stuff your info only one who worked for me! Thank you very much! Internet roool’s!

  24. Minexew permalink

    I think much better solution is to simply use wxDev-C++ instead of the old abandoned Dev-C++ (

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: