How to compile C program on command line using MinGW?

It indicates it couldn’t find gcc.exe.

I have a path environment variable set to where MinGW is installed

Maybe you haven’t set the path correctly?

echo %path%

shows the path to gcc.exe? Otherwise, compilation is similar to Unix:

gcc filename.c -o filename

Leave a Comment