Link to home
Start Free TrialLog in
Avatar of lwinkenb
lwinkenb

asked on

Makefile question. "No rule to make target..."

If I have a makefile rule like:

myprog.o : myprog.cpp
    g++ -g -Wall -c myprog.cpp

Why does make say:
"make:  *** No rule to make target `myprog.cpp', needed by `myprog.o'.  Stop."

How do you set up a rule to make a cpp file?
ASKER CERTIFIED SOLUTION
Avatar of smidgie82
smidgie82
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of lwinkenb
lwinkenb

ASKER

well I do have a directory structure like:

Makefile
Sources (directory)
Include (directory)

How do I tell the Makefile that the source files are in the Sources directory.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
then in the sources directory you can do

INCL = -I. -I../ -I../Include
OPTIONS = -Wall -O2

all:
.c.o:
      $(CC) -c $(OPTIONS) $(INCL) $< -o $@


regards
Manish Regmi