Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gcc makefile error: "No rule to make target ..."

Tags:

gcc

makefile

I'm trying to use GCC (linux) with a makefile to compile my project.

I get the following error which is can't seem to decipher in this context:

"No rule to make target 'vertex.cpp', needed by 'vertex.o'.  Stop." 

This is the makefile:

a.out: vertex.o edge.o elist.o main.o vlist.o enode.o vnode.o     g++ vertex.o edge.o elist.o main.o vlist.o enode.o vnode.o  main.o: main.cpp main.h     g++ -c main.cpp  vertex.o: vertex.cpp vertex.h     g++ -c vertex.cpp  edge.o: edge.cpp edge.h     g++ -c num.cpp  vlist.o: vlist.cpp vlist.h     g++ -c vlist.cpp  elist.o: elist.cpp elist.h     g++ -c elist.cpp  vnode.o: vnode.cpp vnode.h     g++ -c vnode.cpp  enode.o: enode.cpp enode.h     g++ -c node.cpp 
like image 312
Meir Avatar asked May 07 '09 13:05

Meir


People also ask

How do you resolve No rule to make target?

No rule to make target generally means simply that you have a compiler version that does not match the original compiler used in the project. You only need to go to the project properties and change the compiler to use the one you installed. Another reason could be that you moved the project or files to another folder.

What is the meaning of No rule to make target?

Answer: The message is formatted as: *** No rule to make target 'file supposed to be input', needed by 'the file going to make'. That is, no rules are defined to locate the input file. This error occurs when there are errors or inconsistencies in build configurations.

What is make target?

A 'make target' is basically a file that you want rebuilt. Make can't divine what you want built, so you have to tell it, implicitly or explicitly, what it should build.

What is in Makefile?

What Makefiles Contain. Makefiles contain five kinds of things: explicit rules , implicit rules , variable definitions , directives , and comments . Rules, variables, and directives are described at length in later chapters. An explicit rule says when and how to remake one or more files, called the rule's targets.


1 Answers

That's usually because you don't have a file called vertex.cpp available to make. Check that:

  • that file exists.
  • you're in the right directory when you make.

Other than that, I've not much else to suggest. Perhaps you could give us a directory listing of that directory.

like image 170
paxdiablo Avatar answered Sep 19 '22 00:09

paxdiablo