简体   繁体   English

在Debian上编译OpenCV时出错

[英]Errors Compiling OpenCV on Debian

I installed OpenCV from the repos on my Debian Wheezy (64bits). 我在Debian Wheezy(64位)上从存储库安装了OpenCV。 I was able to compile the source file of an example but when it goes to the build step this happens: 我能够编译示例的源文件,但是在进行build步骤时会发生这种情况:

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

I am using NetBeans 8.0 and OpenCV2.3 (from the repo). 我正在使用NetBeans 8.0和OpenCV2.3(从存储库中)。

Any suggestions on what I could be missing? 关于我可能会缺少的任何建议吗?

Thanks! 谢谢!

@berak is totally right on his comment, for that was the problem. @berak对他的评论完全正确,因为那是问题所在。

I forgot to add the libraries to the linker configuration. 我忘记将库添加到链接器配置中。 :P :P

As for 2.3 in 2014: I agree. 至于2014年的2.3:我同意。 I am planning to use 3.o alpha but this is what the repo had and I didn't want to compile the whole thing just to run some samples. 我打算使用3.o alpha,但这就是仓库的内容,我不想为了运行一些样本而编译整个文件。

Thank you @berac! 谢谢@berac! I hope the question is still useful for someone out there. 我希望这个问题对那里的人仍然有用。

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

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