Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

process_begin: CreateProcess(NULL, ls, …) failed. make (e=2): The system cannot find the file specified

I have a simple make file:

CC=gcc

output.exe: main.o
    $(CC) main.o -o output.exe

main.o: main.cpp
    $(CC) -c main.cpp -o main.o

clean:
    rm *.o

and when i run

make clean

i get the next output and error:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

rm *.o
process_begin: CreateProcess(NULL, ls, ...) failed.
make (e=2): The system cannot find the file specified.
make: *** [Makefile:10: clean] Error 2

NOTE! when i run a simple make command:

make

i dont get any error and everything runs smoothly.

whats the deal with the error?

>Solution :

rm is not a command that exists on Windows. At least not by default.

I recommend installing MSYS2 and installing Make in it. Make provides ports of Linux-like utilities, including rm. Using its make will give you access to rm (among other things), which is way easier than trying to write cross-platform makefiles by switching to different commands on Windows.

Alternatively, as a quick fix, use a Windows-specific command (del *.o, I believe?).

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading