gcc cannot find -lgcc, g++.exe: error: CreateProcess: No such file or directory

Viewed 2008

I'm trying to use MingGW on Windows but when I try to compile my c/c++ files, following error occurs when I compile with C(gcc)

> gcc c:\Users\Administrator\Desktop\C_C++\helloworld\hello.c - o c:\Users\Administrator\Desktop\C_C++\helloworld/hello

c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/ld.exe: cannot find -lgcc
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/ld.exe: cannot find -lgcc_eh
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/ld.exe: cannot find -lgcc
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/ld.exe: cannot find -lgcc_eh
collect2.exe: error: ld returned 1 exit status

and following error occurs when I compile with C++(g++)

> g++ c:\Users\Administrator\Desktop\C_C++\helloworldcpp\hello.cpp -o c:\Users\Administrator\Desktop\C_C++\helloworldcpp/hello

g++.exe: error: CreateProcess: No such file or directory

The path variable is C:\MinGW\bin . I've downloaded mingw-developer-toolkit, mingw32-base, mingw32-gcc-g++ and msys-base among the basic setup packages. Also I'm getting #include error for iostream. I've tried almost all of the methods out in the internet but couldn't fix.

1 Answers

It seems like MinGW wasn't installed correctly.

Re-installing it will likely fix the issue.

Related