2012-06-04 3 views
0

Я пытаюсь запустить BRIEF_demo-0.5 в своей среде linux. Как указано в файле read me, я меняю свой каталог на файл BRIEF_demo-0.5 и набрал make, но у меня появились следующие ошибки. .не может запускать BRIEF_demo на linux

g++ `pkg-config opencv --libs` main.o BRIEF.o -o BRIEF_demo 
main.o: In function `matchDescriptors(CvMat&, CvMat&, std::vector<std::bitset<256ul>, std::allocator<std::bitset<256ul> > >, std::vector<std::bitset<256ul>, std::allocator<std::bitset<256ul> > >, std::vector<cv::KeyPoint, std::allocator<cv::KeyPoint> > const&, std::vector<cv::KeyPoint, std::allocator<cv::KeyPoint> > const&) [clone .constprop.66]': 
main.cpp:(.text+0x1f6): undefined reference to `cvInitMatHeader' 
main.cpp:(.text+0x218): undefined reference to `cvInitMatHeader' 
main.o: In function `drawQuadrangle(_IplImage*, int, int, int, int, int, int, int, int, CvScalar, int) [clone .constprop.71]': 
main.cpp:(.text+0x2d5): undefined reference to `cvLine' 
main.cpp:(.text+0x333): undefined reference to `cvLine' 
main.cpp:(.text+0x398): undefined reference to `cvLine' 
main.cpp:(.text+0x3f2): undefined reference to `cvLine' 
main.o: In function `waitKeyAndHandleKeyboardInput(int)': 
main.cpp:(.text+0x485): undefined reference to `cvWaitKey' 
main.o: In function `drawQuadrangle(_IplImage*, int, int, int, int, int, int, int, int, CvScalar, int)': 
main.cpp:(.text+0x5c6): undefined reference to `cvLine' 
main.cpp:(.text+0x625): undefined reference to `cvLine' 
main.cpp:(.text+0x68d): undefined reference to `cvLine' 
main.cpp:(.text+0x6e4): undefined reference to `cvLine' 
main.o: In function `drawAPlus(_IplImage*, int, int)': 
main.cpp:(.text+0x867): undefined reference to `cvLine' 
main.o:main.cpp:(.text+0x8ce): more undefined references to `cvLine' follow 
main.o: In function `takeNewFrame()': 
main.cpp:(.text+0x99c): undefined reference to `cvQueryFrame' 
main.cpp:(.text+0x9be): undefined reference to `cvCvtColor' 
main.o: In function `showMatches(int)': 
main.cpp:(.text+0xb37): undefined reference to `cvLine' 
main.o: In function `rotateImage(_IplImage*, _IplImage*, CvPoint2D32f const&, float)': 
main.cpp:(.text+0xf0a): undefined reference to `cv2DRotationMatrix' 
main.cpp:(.text+0xf68): undefined reference to `cvWarpAffine' 
main.cpp:(.text+0xf90): undefined reference to `cvCreateMat' 
main.o: In function `fpsCalculation()': 
main.cpp:(.text+0x11ac): undefined reference to `cvGetTickCount' 
main.cpp:(.text+0x11d0): undefined reference to `cvGetTickFrequency' 
main.cpp:(.text+0x1211): undefined reference to `cvGetTickCount' 
main.o: In function `showOutput(_IplImage*)': 
main.cpp:(.text+0x12f5): undefined reference to `cvPutText' 
main.cpp:(.text+0x1308): undefined reference to `cvGetTickFrequency' 
main.cpp:(.text+0x13ab): undefined reference to `cvPutText' 
main.cpp:(.text+0x13be): undefined reference to `cvGetTickFrequency' 
main.cpp:(.text+0x1467): undefined reference to `cvPutText' 
main.cpp:(.text+0x147a): undefined reference to `cvGetTickFrequency' 
main.cpp:(.text+0x1529): undefined reference to `cvPutText' 
main.cpp:(.text+0x153c): undefined reference to `cvGetTickFrequency' 
main.cpp:(.text+0x15eb): undefined reference to `cvPutText' 
main.cpp:(.text+0x15fe): undefined reference to `cvGetTickFrequency' 
main.cpp:(.text+0x16ad): undefined reference to `cvPutText' 
main.cpp:(.text+0x174a): undefined reference to `cvPutText' 
main.o: In function `extractKeypoints(std::vector<cv::KeyPoint, std::allocator<cv::KeyPoint> >&, int, _IplImage*)': 
main.cpp:(.text+0x17b3): undefined reference to `cvSetImageROI' 
main.cpp:(.text+0x17c0): undefined reference to `cv::Mat::Mat(_IplImage const*, bool)' 
main.cpp:(.text+0x17d3): undefined reference to `cv::FAST(cv::Mat const&, std::vector<cv::KeyPoint, std::allocator<cv::KeyPoint> >&, int, bool)' 
main.cpp:(.text+0x183b): undefined reference to `cv::fastFree(void*)' 
main.cpp:(.text+0x1843): undefined reference to `cvResetImageROI' 
main.cpp:(.text+0x18c4): undefined reference to `cv::Mat::deallocate()' 
main.cpp:(.text+0x18ec): undefined reference to `cv::Mat::deallocate()' 
main.cpp:(.text+0x1938): undefined reference to `cv::fastFree(void*)' 
main.o: In function `chooseFASTThreshold(_IplImage const*, int, int)': 
main.cpp:(.text+0x197d): undefined reference to `cvGetSize' 
main.cpp:(.text+0x198e): undefined reference to `cvCreateImage' 
main.cpp:(.text+0x19ab): undefined reference to `cvCopy' 
main.cpp:(.text+0x19f6): undefined reference to `cvReleaseImage' 
main.o: In function `saveNewTemplate()': 
main.cpp:(.text+0x1b50): undefined reference to `cvCopy' 
main.cpp:(.text+0x1b5a): undefined reference to `cvReleaseImage' 
main.cpp:(.text+0x1b6c): undefined reference to `cvCreateImage' 
main.cpp:(.text+0x1b7d): undefined reference to `cvReleaseImage' 
main.cpp:(.text+0x1b8f): undefined reference to `cvCreateImage' 
main.cpp:(.text+0x1bab): undefined reference to `cvSetImageROI' 
main.cpp:(.text+0x1bc0): undefined reference to `cvCopy' 
main.cpp:(.text+0x1bcc): undefined reference to `cvResetImageROI' 
main.cpp:(.text+0x1be1): undefined reference to `cvSetImageROI' 
main.cpp:(.text+0x1bf6): undefined reference to `cvCopy' 
main.cpp:(.text+0x1c02): undefined reference to `cvResetImageROI' 
main.o: In function `learnTemplate()': 
main.cpp:(.text+0x20da): undefined reference to `cvGetSize' 
main.cpp:(.text+0x20ed): undefined reference to `cvCreateImage' 
main.cpp:(.text+0x2106): undefined reference to `cvCopy' 
main.cpp:(.text+0x2162): undefined reference to `cvReleaseImage' 
main.cpp:(.text+0x21c0): undefined reference to `cvCreateImage' 
main.cpp:(.text+0x21d9): undefined reference to `cvResize' 
main.cpp:(.text+0x2259): undefined reference to `cv2DRotationMatrix' 
main.cpp:(.text+0x22b7): undefined reference to `cvWarpAffine' 
main.cpp:(.text+0x2323): undefined reference to `cvReleaseImage' 
main.cpp:(.text+0x2351): undefined reference to `cvGetSize' 
main.cpp:(.text+0x235e): undefined reference to `cvCreateImage' 
main.cpp:(.text+0x239e): undefined reference to `cvCreateMat' 
main.cpp:(.text+0x23ca): undefined reference to `cvReleaseImage' 
main.o: In function `takeNewTemplateImage()': 
main.cpp:(.text+0x24a5): undefined reference to `cvCopy' 
main.cpp:(.text+0x253f): undefined reference to `cvRectangle' 
main.o: In function `matchDescriptors(CvMat&, CvMat&, std::vector<std::bitset<256ul>, std::allocator<std::bitset<256ul> > >, std::vector<std::bitset<256ul>, std::allocator<std::bitset<256ul> > >, std::vector<cv::KeyPoint, std::allocator<cv::KeyPoint> > const&, std::vector<cv::KeyPoint, std::allocator<cv::KeyPoint> > const&)': 
main.cpp:(.text+0x2736): undefined reference to `cvInitMatHeader' 
main.cpp:(.text+0x2758): undefined reference to `cvInitMatHeader' 
main.o: In function `init()': 
main.cpp:(.text+0x27b4): undefined reference to `cvCreateCameraCapture' 
main.cpp:(.text+0x27d0): undefined reference to `cvSetCaptureProperty' 
main.cpp:(.text+0x27e9): undefined reference to `cvSetCaptureProperty' 
main.cpp:(.text+0x2802): undefined reference to `cvCreateImage' 
main.cpp:(.text+0x2822): undefined reference to `cvCreateImage' 
main.cpp:(.text+0x2842): undefined reference to `cvCreateImage' 
main.cpp:(.text+0x286c): undefined reference to `cvCreateImage' 
main.cpp:(.text+0x2889): undefined reference to `cvCreateImage' 
main.o:main.cpp:(.text+0x28a6): more undefined references to `cvCreateImage' follow 
main.o: In function `init()': 
main.cpp:(.text+0x294b): undefined reference to `cvNamedWindow' 
main.cpp:(.text+0x295c): undefined reference to `cvSetMouseCallback' 
main.o: In function `doDetection()': 
main.cpp:(.text+0x2a4f): undefined reference to `cvGetTickCount' 
main.cpp:(.text+0x2a8f): undefined reference to `cvGetTickCount' 
main.cpp:(.text+0x2ab7): undefined reference to `cvGetTickCount' 
main.cpp:(.text+0x2ae4): undefined reference to `cvGetTickCount' 
main.cpp:(.text+0x2b04): undefined reference to `cvGetTickCount' 
main.o:main.cpp:(.text+0x2e28): more undefined references to `cvGetTickCount' follow 
main.o: In function `doDetection()': 
main.cpp:(.text+0x3116): undefined reference to `cvFindHomography' 
main.cpp:(.text+0x32b2): undefined reference to `cvCreateMat' 
main.cpp:(.text+0x333f): undefined reference to `cvGetTickCount' 
main.cpp:(.text+0x336a): undefined reference to `cvPerspectiveTransform' 
main.cpp:(.text+0x336f): undefined reference to `cvGetTickCount' 
main.o: In function `run()': 
main.cpp:(.text+0x34f4): undefined reference to `cvWaitKey' 
main.cpp:(.text+0x35a0): undefined reference to `cvQueryFrame' 
main.cpp:(.text+0x35c2): undefined reference to `cvCvtColor' 
main.cpp:(.text+0x35dc): undefined reference to `cvCopy' 
main.cpp:(.text+0x3671): undefined reference to `cvQueryFrame' 
main.cpp:(.text+0x3693): undefined reference to `cvCvtColor' 
main.cpp:(.text+0x36a8): undefined reference to `cvCopy' 
main.o: In function `showOutput(_IplImage*)': 
main.cpp:(.text+0x175f): undefined reference to `cvShowImage' 
main.o: In function `init()': 
main.cpp:(.text+0x298f): undefined reference to `cvInitFont' 
BRIEF.o: In function `CVLAB::BRIEF::~BRIEF()': 
BRIEF.cpp:(.text+0x1c): undefined reference to `cvReleaseMat' 
BRIEF.o: In function `CVLAB::BRIEF::~BRIEF()': 
BRIEF.cpp:(.text+0x7c): undefined reference to `cvReleaseMat' 
BRIEF.o: In function `CVLAB::BRIEF::BRIEF()': 
BRIEF.cpp:(.text+0x1f3): undefined reference to `cvCreateMat' 
BRIEF.o: In function `CVLAB::BRIEF::allocateIntegralImage(_IplImage const*)': 
BRIEF.cpp:(.text+0x868): undefined reference to `cvReleaseMat' 
BRIEF.cpp:(.text+0x877): undefined reference to `cvCreateMat' 
BRIEF.o: In function `CVLAB::BRIEF::getBriefDescriptors(std::vector<std::bitset<256ul>, std::allocator<std::bitset<256ul> > >&, std::vector<cv::KeyPoint, std::allocator<cv::KeyPoint> > const&, _IplImage*)': 
BRIEF.cpp:(.text+0x9cd): undefined reference to `cvReleaseMat' 
BRIEF.cpp:(.text+0x9dd): undefined reference to `cvCreateMat' 
BRIEF.cpp:(.text+0x9f0): undefined reference to `cvIntegral' 
collect2: ld returned 1 exit status 
make: *** [BRIEF_demo] Error 1 

так ... как указано я один из постов я пытался команду г ++ main.cpp BRIEF.cpp -lm -lml -lcvaux -lhighgui -lcv -lcxcore и я получил

/usr/bin/ld: cannot find -lml 
/usr/bin/ld: cannot find -lcvaux 
/usr/bin/ld: cannot find -lhighgui 
/usr/bin/ld: cannot find -lcv 
/usr/bin/ld: cannot find -lcxcore 
collect2: ld returned 1 exit status 

когда я печатаю pkg-config opencv --libs - -cflags я получаю -I/usr/local/include/opencv -I/usr/local/include -L/usr/local/lib -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_ml -lopencv_video -lopencv_features2d -lopencv_calib3d -lopencv_objdetect -lopencv_contrib -lopencv_legacy -lopencv_flann

пожалуйста, помогите ...

ответ

1

эта линия:

g++ `pkg-config opencv --libs` main.o BRIEF.o -o BRIEF_demo 

следует читать:

g++ main.o BRIEF.o -o BRIEF_demo `pkg-config opencv --libs` 

или, если вы редактируете Makefile:

$(EXECUTABLE): $(OBJECTS) 
    $(CC) $(OBJECTS) -o [email protected] $(LDFLAGS) 

т.е. переместить $(LDFLAGS) до конца строки.

Происходит то, что ссылка на зависимые библиотеки пропускается, поскольку в то время, когда они указаны, они фактически не нужны. Они необходимы после обработки файлов main.o и BRIEF.o, поэтому в этот момент они будут связаны.

Это причуда связи.

Смежные вопросы