2014-10-16 93 views
0

我在Debian Wheezy(64位)上從Repos上安裝了OpenCV。我能夠編譯一個例子的源文件,但是當它進入build步出現這種情況:在Debian上編譯OpenCV的錯誤

g++  -o dist/Debug/GNU-Linux-x86/opencvtestapp build/Debug/GNU-Linux-x86/main.o 

build/Debug/GNU-Linux-x86/main.o: In function `main': 
/home/ ... /main.cpp:9: undefined reference to `cv::VideoCapture::VideoCapture(int)' 
/home/ ... /main.cpp:11: undefined reference to `cv::VideoCapture::isOpened() const' 
/home/ ... /main.cpp:16: undefined reference to `cv::VideoCapture::get(int)' 
/home/ ... /main.cpp:17: undefined reference to `cv::VideoCapture::get(int)' 
/home/ ... /main.cpp:21: undefined reference to `cv::namedWindow(std::string const&, int)' 
/home/ ... /main.cpp:26: undefined reference to `cv::VideoCapture::read(cv::Mat&)' 
/home/ ... /main.cpp:33: undefined reference to `cv::_InputArray::_InputArray(cv::Mat const&)' 
/home/ ... /main.cpp:33: undefined reference to `cv::imshow(std::string const&, cv::_InputArray const&)' 
/home/ ... /main.cpp:35: undefined reference to `cv::waitKey(int)' 
/home/ ... /main.cpp:40: undefined reference to `cv::VideoCapture::~VideoCapture()' 
/home/ ... /main.cpp:40: undefined reference to `cv::VideoCapture::~VideoCapture()' 

build/Debug/GNU-Linux-x86/main.o: In function `cv::Mat::~Mat()': 
/usr/include/opencv2/core/mat.hpp:297: undefined reference to `cv::fastFree(void*)' 

build/Debug/GNU-Linux-x86/main.o: In function `cv::Mat::release()': 
/usr/include/opencv2/core/mat.hpp:382: undefined reference to `cv::Mat::deallocate()' 

collect2: error: ld returned 1 exit status 
make[2]: *** [dist/Debug/GNU-Linux-x86/opencvtestapp] Error 1 
make[2]: Leaving directory `/home/work/OpenCVTestApp' 
make[1]: *** [.build-conf] Error 2 
make[1]: Leaving directory `/home/work/OpenCVTestApp' 
make: *** [.build-impl] Error 2 

我使用NetBeans 8.0和OpenCV2.3(從回購)。

關於我可能錯過的任何建議?

謝謝!

+2

哎。 opencv2.3。在2014年?但真正的問題是,你不鏈接* opencv庫(opencv_core,opencv_highgui) – berak 2014-10-16 17:58:41

回答

0

@berak對他的評論完全正確,因爲這是問題所在。

我忘了將庫添加到鏈接器配置。 :P

2014年2.3:我同意。我打算使用3.o alpha,但這是回購的原因,我不想編譯整個事情只是爲了運行一些樣本。

謝謝@berac!我希望這個問題對那裏的人仍然有用。