简体   繁体   English

Eclipse CDT显示一些错误,但是该项目已成功构建

[英]Eclipse CDT shows some errors, but the project is successfully built

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). 我有一个包含多个源文件和头文件的项目,并通过指定所需的外部库和头(包含OpenCV头文件的目录和包含OpenCV库的目录)编写了自己的Makefile。

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. 但是,在编写代码时,Eclipse报告有关OpenCV某些功能的错误,好像它不知道这些功能一样。 Since I have listed all the required headers and libraries in the makefile (see below), why does this problem occur? 由于我已经在makefile中列出了所有必需的标头和库(请参见下文),为什么会出现此问题?

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)

Eclipse tries to find the errors quickly, but does not update all the time. Eclipse会尝试快速发现错误,但不会一直更新。 Do not rely only on the error messages of Eclipse. 不要仅依赖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. 例如,如果您刚刚将文件添加到项目中,则Eclipse可能仍然告诉您,文件实际上在那儿却找不到。

Use Project -> Clean to update the error checking of Eclipse. 使用项目->清理来更新Eclipse的错误检查。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM