2014-03-27 100 views
0

我試圖編譯OpenCV的文件不過highgui庫似乎沒有發現OpenCV中找不到highgui

g++ -O2 -W -Wall -lhighgui tracking.cc -o tracking 
/usr/bin/ld: cannot find -lhighgui 
collect2: error: ld returned 1 exit status 

任何想法如何解決這一問題?

我試圖

updatedb 
ldconfig 
g++ -O2 -W -Wall -L/usr/lib/libopencv_highgui.so tracking.cc -o tracking 

但似乎沒有任何工作..

編輯: 發出pkg配置--libs --cflags OpenCV的 回報:

-I/usr/local/include/opencv -I/usr/local/include /usr/local/lib/libopencv_calib3d.so /usr/local/lib/libopencv_contrib.so /usr/local/lib/libopencv_core.so /usr/local/lib/libopencv_features2d.so /usr/local/lib/libopencv_flann.so /usr/local/lib/libopencv_gpu.so /usr/local/lib/libopencv_highgui.so /usr/local/lib/libopencv_imgproc.so /usr/local/lib/libopencv_legacy.so /usr/local/lib/libopencv_ml.so /usr/local/lib/libopencv_nonfree.so /usr/local/lib/libopencv_objdetect.so /usr/local/lib/libopencv_ocl.so /usr/local/lib/libopencv_photo.so /usr/local/lib/libopencv_stitching.so /usr/local/lib/libopencv_superres.so /usr/local/lib/libopencv_ts.a /usr/local/lib/libopencv_video.so /usr/local/lib/libopencv_videostab.so -lrt -lpthread -lm -ldl 

發出

克++ pkg-config --libs --cflags opencv -L/USR /本地/ LIB/tracking.cc -o跟蹤

返回

/tmp/ccrc3n9d.o:在功能main': tracking.cc:(.text+0x53): undefined reference to cvCreateCameraCapture」 tracking.cc:(.text+0x95) :未定義的引用cvNamedWindow' tracking.cc:(.text+0xb1): undefined reference to cvMoveWindow ' tracking.cc:(.text+0xc5):未定義的引用cvNamedWindow' tracking.cc:(.text+0xe1): undefined reference to cvMoveWindow' ......

不知道!

+1

你使用-L傳遞文件夾,而不是文件。試試:-L/usr/lib/-lopencv_highgui(也可以看一下,它可能是/ usr/local/lib /) – berak

+0

確定這是多次嘗試之一..仍然不知道,但開始思考這不是在編譯本身的東西,但在opencv – dendini

+0

一些錯誤,親愛的,..... – berak

回答

0

好找到了解決辦法,只是將我的代碼的OpenCV的樣本目錄,並呼籲buildall.sh

內部在一個單獨的說明isntalling OpenCV的不建議,但不是手工連接,每次最好。