Ubuntu 11.10 上的 OpenCV

OpenCV on ubuntu 11.10(Ubuntu 11.10 上的 OpenCV)
本文介绍了Ubuntu 11.10 上的 OpenCV的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚将我的系统从 ubuntu 11.04 更新到 11.10,现在我无法再编译任何包含对 OpenCV 库的引用的 C 程序

I've just updated my system from ubuntu 11.04 to 11.10 and now I can't compile anymore any C program that contain references to OpenCV libraries

我已经尝试重新安装 OpenCV(我使用 2.1 版本),但我遇到了这个错误:

I've already tried to reinstall OpenCV (I use the 2.1 version) but I'm stuck with this error:

/tmp/ccArHTZL.o: In function `main':
z.c:(.text+0x59): undefined reference to `cvLoadImage'
z.c:(.text+0xa0): undefined reference to `cvNamedWindow'
z.c:(.text+0xb1): undefined reference to `cvShowImage'
z.c:(.text+0xbb): undefined reference to `cvWaitKey'
z.c:(.text+0xc5): undefined reference to `cvDestroyWindow'
z.c:(.text+0xd1): undefined reference to `cvReleaseImage'
collect2: ld returned 1 exit status

为了安装 OpenCV,我一直遵循以下步骤:

In order to install OpenCV I've always followed this procedure:

$ sudo apt-get install libcv2.1 libcv-dev libcvaux2.1 libcvaux-dev libhighgui2.1
     libhighgui-dev opencv-doc python-opencv

$ export LD_LIBRARY_PATH=/home/opencv/lib
$ export PKG_CONFIG_PATH=/home/opencv/lib/pkgconfig

$ pkg-config --cflags opencv
     -I/usr/include/opencv

$ pkg-config --libs opencv
     -lcxcore -lcv -lhighgui -lcvaux -lml

$ g++ -I/usr/include/opencv -lcxcore -lhighgui -lm hello.c

有人可以帮我吗?

推荐答案

你为什么不使用 pkg-config 对你有利?

Why don't you use pkg-config to your favor?

g++ hello.c -o hello `pkg-config --cflags --libs opencv` 

这篇关于Ubuntu 11.10 上的 OpenCV的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Linker returns quot;relocation has an invalid symbol at symbol index...quot;(链接器返回“重定位在符号索引处具有无效符号...)
Ambiguous call with overloaded r-value reference function(带有重载 r 值引用函数的模棱两可的调用)
Compile c++14-code with g++(用 g++ 编译 c++14 代码)
openCV program compile error quot;libopencv_core.so.2.4: cannot open shared object file: No such file or directoryquot; in ubuntu 12.04(openCV程序编译错误“libopencv_core.so.2.4:无法打开共享对象文件:没有这样的文件或目录在 Ubuntu 12.04 中)
gdb error not in executable format: File format not recognized(gdb 错误不是可执行格式:文件格式无法识别)
How to list exported functions in a shared lib on Ubuntu(如何在 Ubuntu 的共享库中列出导出的函数)