1

I have a project of multiple source and header files and I wrote my own Makefile by specifying the required external libraries and headers (the directory containing the OpenCV header files and the directory containing the OpenCV libraries).

When I start compiling the project, it is compiled without any errors. However when writing the code, Eclipse reports errors on some functions of OpenCV, as if it did not know these functions. Since I have listed all the required headers and libraries in the makefile (see below), why does this problem occur?

CXXFLAGS = -O3 -g -Wall -fmessage-length=0 -I./include -I/usr/local/include/opencv
LIBS = -L/usr/local/lib -lcv -lcvaux -lhighgui -lcxcore -limgproc

MAIN_PROG_OBJS =    MainProgram.o src/Utilities.o src/ImageStream.o src/VideoStream.o
MAIN_PROG_TARGET =  MainProgram

TEST_PROG_OBJS = TestProgram.o src/Utilities.o
TEST_PROG_TARGET = TestProgram

$(MAIN_PROG_TARGET):    $(MAIN_PROG_OBJS)
    $(CXX) -o $(MAIN_PROG_TARGET) $(MAIN_PROG_OBJS) $(LIBS)

$(TEST_PROG_TARGET):    $(TEST_PROG_OBJS)
    $(CXX) -o $(TEST_PROG_TARGET) $(TEST_PROG_OBJS) $(LIBS)

all:    $(MAIN_PROG_TARGET) $(TEST_PROG_TARGET)

clean:
    rm -f $(MAIN_PROG_OBJS) $(MAIN_PROG_TARGET) $(TEST_PROG_OBJS) $(TEST_PROG_TARGET)
enzom83
  • 8,080
  • 10
  • 68
  • 114

1 Answers1

1

Eclipse tries to find the errors quickly, but does not update all the time. Do not rely only on the error messages of Eclipse.

For example if you have just added a file to your project, Eclipse might still be telling you that it could not find the file while in fact it is there.

Use Project -> Clean to update the error checking of Eclipse.

Michiel Pater
  • 22,377
  • 5
  • 43
  • 57