2016-06-02 11 views
0

ich will Cross-kompilieren mein Programm, so schrieb ich ein Make-Datei:undefined reference to `cv :: groupRectangles`

CC= arm-buildroot-linux-gnueabihf-g++ 
CFLAGS= -W -Wall -v -O3 -ftree-vectorize -std=c++0x 
OPENCV= -I '/home/slim/Desktop/buildroot-2016.02/output/staging/usr/include/' -L '/home/slim/Desktop/buildroot-2016.02/output/staging/usr/lib' -lopencv_core -lopencv_highgui -lopencv_calib3d -lopencv_features2d -lopencv_flann -lopencv_imgproc -lopencv_video 
BIN = ./bin/ 

all: detection.o Ctracker.o HungarianAlg.o Kalman.o 
    $(CC) $(CFLAGS) $(BIN)detection.o $(BIN)Ctracker.o $(BIN)HungarianAlg.o $(BIN)Kalman.o -o dect $(OPENCV) 



detection.o: Ctracker.h detection.cpp 
    $(CC) $(CFLAGS) $(OPENCV) -c detection.cpp -o $(BIN)detection.o 


Ctracker.o: Ctracker.h HungarianAlg.h Kalman.h 
    $(CC) $(CFLAGS) $(OPENCV) -c Ctracker.cpp -o $(BIN)Ctracker.o 

HungarianAlg.o: HungarianAlg.h 
    $(CC) $(CFLAGS) $(OPENCV) -c HungarianAlg.cpp -o $(BIN)HungarianAlg.o 

Kalman.o: HungarianAlg.h 
    $(CC) $(CFLAGS) -c Kalman.cpp -o $(BIN)Kalman.o 


clean: 
    rm $(BIN)* 

ich alle Linker meiner Bibliotheken in der Make-Datei hinzugefügt, aber wenn ich laufe ich machen diese Fehler bekam aber ich verstand nicht, wie es zu beheben:

./bin/detection.o: In function `drawBoundingBox(std::vector<std::vector<cv::Point_<int>, std::allocator<cv::Point_<int> > >, std::allocator<std::vector<cv::Point_<int>, std::allocator<cv::Point_<int> > > > >)': 
detection.cpp:(.text+0x46c): undefined reference to `cv::groupRectangles(std::vector<cv::Rect_<int>, std::allocator<cv::Rect_<int> > >&, int, double)' 
collect2: error: ld returned 1 exit status 
make: *** [all] Error 1 

Antwort

1

das erste, was zu verstehen, ist, dass Sie ein Linker-Fehler bekommen.

Dann beachten Sie, dass Sie versuchen, zu verwenden, und der Linker schlägt bei der Verknüpfung fehl. Gemäß der openCV documentation ist es Teil des Objekterkennung Moduls.

Ich suchte im Internet nach "OpenCV Object Detection Tutorials" und sie sind alle Verknüpfung opencv_objdetect in ihren Make-Dateien. Versuchen Sie also, -lopencv_objdetect zur dritten Zeile in Ihrem Makefile hinzuzufügen, wo Sie die Variable OPENCV definieren und sehen, ob das hilft.