Search code examples
c++mingw

/bin/sh: cc: command not found


I am running MingW32 on Windows 10. When I try to compile my programme using the command:

$ make -f Makefile

cc -g -Wall -o runScript.exe abc.o def.o ghi.o -lgdi32 -lcomdlg32 #-mwindows

I get an error:

/bin/sh: cc: command not found
make: ***[runScript.exe] Error 127

Will appreciate a solution to this.


Solution

  • The trick with Makefile not finding cc when using gcc is usually setting CC=gcc.exe (and if needed CXX=g++.exe, you can also specify the full path if you like) either as environment variables or on the make command line like this: make CC=gcc.exe (you shouldn't really need to add -f Makefile as that's the default).