I'm trying to create a makefile that runs a basic Hello World file seen here:
#include <stdio.h>
int main() {
printf("Hello World");
return 0;
}
And my makefile:
CFLAGS = -Wall -g
helloworld: helloworld.o
cc -o helloworld helloworld.o
clean:
rm helloworld helloworld.o
I keep getting an error that fails to run cc -Wall -g -c -o helloworld.o helloworld.c. I looked at another stack overflow that says that cc may not be installed? But I understand that cc is just the c compiler but I usually use gcc(which cc is an alias of) to compile the file without makefile but even when I use gcc in the makefile I still get an error. Here is the entire error:
C:est>make -f makefile.mk
cc -Wall -g -c -o helloworld.o helloworld.c
process_begin: CreateProcess(NULL, cc -Wall -g -c -o helloworld.o helloworld.c, ...) failed.
make (e=2): The system cannot find the file specified.
make: *** [helloworld1.o] Error 2
Any help would be great.
question from:https://stackoverflow.com/questions/65545419/cc-command-does-not-work-to-create-object-file