CyberFlow
CyberFlow

Reputation: 31

Compiling C using make in windows (MinGW)

I am following the book "Learn C the Hard Way" and I have reached the section where you compile the code using makefiles. I keep getting errors that the file was not found when running make clean. Here is the error followed by the make file and the directory

C:\Users\Me\Desktop\C Code\HARD WAY\Dust off that compiler>make clean
rm -f main.c
process_begin: CreateProcess(NULL, rm -f main.c, ...) failed.
make (e=2): The system cannot find the file specified.
make: *** [makefile:7: clean] Error 2
EXECUTABLE=main.exe
    
CC="C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin\gcc.exe"
    
CFLAGS=-Wall -g
clean:
    rm -f main

directories

EDIT: I removed the .c from the "rm -f main" as it seems to be a small error but has made no difference to the end result

EDIT 2: I worked out that the make file is issuing linux commands which is why it wasn't working, replacing rm with del fixes the issue

Upvotes: 1

Views: 746

Answers (1)

CyberFlow
CyberFlow

Reputation: 31

I worked out that the make file is issuing linux commands which is why it wasn't working, replacing rm with del and removing -f fixes the issue

Upvotes: 1

Related Questions