开发者

No targets specified and no makefile found

I have a make file that contains this code:

all: main.o Etudiant.o
    gcc -lobjc -o program main.o Etudiant.o
main.o:main.m Etudiant.h
    gcc -c main.m
Etudiant.o:Etudiant.m Etudiant.h
    gcc -c Etudiant.m

When I write this in the shell command:

$make

I got this:

make: **** No targets specified and no makefile found.开发者_如何学Go Stop.

How do I fix this?


Mmm... makefiles. Whee.

All that whitespace at the beginning of the line. That has to be tabs. Or Make will barf up a really obscure error. Make sure those are tabs and try again.


See the button on the left side of the keyboard labeled "tab". Delete the spaces and hit that once to insert a tab character.


Try make all. IIRC (been a few years since I've had to muck with makefiles) most makes will default to all, but maybe yours isn't.

Extension doesn't matter.


Holy Heck! We are all Extra Dense(@bbum mostly so)!

"no Makefile found" means... well.. that Make didn't even see the makefile. The suggestions to rename the Makefile.m to Makefile are correct. As well, the whole tab vs. whitespace thing is certainly pertinent.


and no makefile found

If you just type make with no arguments or make all, make will look for a file called Makefile in the current directory. If it's not there, you get the error you saw. make will not look in subdirectories for Makefile nor will it accept a file called Makefile.m.


In my case, the my makefile had the name MakeFile, changing it to Makefile worked


Re:
$ Make Make: * No targets specified and no makefile found. Stop.

I just had this error and found that the Makefile extension (none) had been converted to .bat somewhere along the line.


Just spent a few insanely frustrating moments with this error. My mistake was not all that subtle: I titled the makefile MakeFile not Makefile, so even using the -f Makefile command (forcing the makefile name) still resulted in not-found, because it was MakeFile, not Makefile.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜