When I run my makefile I get this error:

** No rule to make target videofeatures.cpp', needed byvideofeatures.o'. Stop.

Here is my makefile

CC  = gcc
CPP = g++
BIN_DIR = ../bin
INC_DIR = ../include
LIB_DIR = ../lib
INCL    = -I$(INC_DIR) `pkg-config --cflags opencv`
LIBS    = -L$(LIB_DIR) -lopensift `pkg-config --libs opencv`
OBJ = imgfeatures.o videofeatures.o utils.o sift.o kdtree.o minpq.o xform.o 
BIN     = siftfeat match dspfeat vidfeat

all: $(BIN) libopensift.a

libopensift.a: $(OBJ)
    ar rc $(LIB_DIR)/$@ $(OBJ)
    ranlib  $(LIB_DIR)/$@

siftfeat: libopensift.a siftfeat.c
    $(CC) $(CFLAGS) $(INCL) siftfeat.c -o $(BIN_DIR)/$@ $(LIBS)

match: libopensift.a match.c
    $(CC) $(CFLAGS) $(INCL) match.c -o $(BIN_DIR)/$@ $(LIBS)

dspfeat: libopensift.a dspfeat.c
    $(CC) $(CFLAGS) $(INCL) dspfeat.c -o $(BIN_DIR)/$@ $(LIBS)

vidfeat: libopensift.a videofeatures.cpp
    $(CCP) $(CFLAGS) $(INCL) videofeatures.cpp -o $(BIN_DIR)/$@ $(LIBS)

videofeatures.o: videofeatures.cpp $(INC_DIR)/videofeatures.h
    $(CPP) $(CFLAGS) $(INCL) -c videofeatures.cpp -o $@

utils.o: utils.c $(INC_DIR)/utils.h
    $(CC) $(CFLAGS) $(INCL) -c utils.c -o $@

sift.o: sift.c $(INC_DIR)/sift.h
    $(CC) $(CFLAGS) $(INCL) -c sift.c -o $@

kdtree.o: kdtree.c $(INC_DIR)/kdtree.h
    $(CC) $(CFLAGS) $(INCL) -c kdtree.c -o $@

minpq.o: minpq.c $(INC_DIR)/minpq.h
    $(CC) $(CFLAGS) $(INCL) -c minpq.c -o $@

xform.o: xform.c $(INC_DIR)/xform.h
    $(CC) $(CFLAGS) $(INCL) -c xform.c -o $@

    rm -f *~ *.o core

.PHONY: clean

What am I doing wrong or missing?

Recommended Answers

All 4 Replies

Well, there is a typo on this line:

vidfeat: libopensift.a videofeatures.cpp
    $(CCP) $(CFLAGS) $(INCL) videofeatures.cpp -o $(BIN_DIR)/$@ $(LIBS)

where it should read as:

vidfeat: libopensift.a videofeatures.cpp
    $(CPP) $(CFLAGS) $(INCL) videofeatures.cpp -o $(BIN_DIR)/$@ $(LIBS)

i.e., $(CPP), not $(CCP).

Thanks for that.

However, I am still getting the same error.

It doesn't know how to get a file named videofeatures.cpp

Is that file definitely named that, and in te right place?

The file name was wrong.


Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.