Reputation: 560
I'm new to Makefile, and I tried to make a simplest Makefile. But I don't understand why even though I'm clearly in the correct path to the Makefile, the make command still says "make: *** No targets specified and no makefile found. Stop."?~
CC=gcc
CFLAGS=-I.
exercise1: exercise1.c
$(CC) -o exercise1 exercise1.c
files in ..TH\Week1 : exercise1.c, Makefile
Upvotes: 0
Views: 1629
Reputation: 560
I just tried copying the Exercise1
folder to somewhere else, and it worked! I finally found the error. It's in the pathname to the Makefile. The path goes through a directory named LT Mạng
, and it seems cmd/Powershell/Terminal can't read the special characters. Just change the name of this folder again, for example: LT Mang
. It works fine.
Upvotes: 1
Reputation: 1709
Try the following and see if it works. Make sure there is no typo in the names of the files or anything.
CC = gcc
exercise1: exercise1.c
$(CC) -o $@ exercise1.c
Also try running make with a target name like this:
make exercise1
Upvotes: 0