Ubuntu 中 cmake 和 OpenCV 2.0 的问题
晚安,我正在一个项目中工作,我们在 Ubuntu 10.04 中使用 Cmake 和 OpenCV 2.0,团队中的每个人(我们是微型鼠标竞赛团队)都可以很好地编译代码,但我不能。 这就是 Cmake 对我说的:
tiago@tiago-laptop:~/bioloid/build$ cmake ..
-- Checking GNUCXX version 3/4 to determine OpenCV /opt/net/ path
CMake Error at CMakeModules/FindOpenCV.cmake:348 (MESSAGE):
OpenCV required but some headers or libs not found. Please specify it's
location with OpenCV_ROOT_DIR env. variable.
Call Stack (most recent call first):
CMakeLists.txt:45 (FIND_PACKAGE)
-- Configuring incomplete, errors occurred!
如果我尝试像这样导出变量:
export OpenCV_ROOT_DIR=/usr/local/lib
它不断给出相同的错误,这是 pkg-config --cflags --libs opencv 的输出:
-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
团队中没有人知道该怎么做,我已经删除并重新安装了opencv,这是否有可能是因为我的计算机中还安装了opencv 2.2?
Goodnight, I'm working in a project where we use Cmake and OpenCV 2.0 in Ubuntu 10.04, everyone in the team(we are a micro-mouse contest team) can compile code just fine, but I cant.
This is what Cmake says to me:
tiago@tiago-laptop:~/bioloid/build$ cmake ..
-- Checking GNUCXX version 3/4 to determine OpenCV /opt/net/ path
CMake Error at CMakeModules/FindOpenCV.cmake:348 (MESSAGE):
OpenCV required but some headers or libs not found. Please specify it's
location with OpenCV_ROOT_DIR env. variable.
Call Stack (most recent call first):
CMakeLists.txt:45 (FIND_PACKAGE)
-- Configuring incomplete, errors occurred!
If I try to export the variable like this:
export OpenCV_ROOT_DIR=/usr/local/lib
It keeps giving the same error, this is the output from pkg-config --cflags --libs opencv:
-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
No one in the team knows what do do, I have already removed and re-instaled opencv, is there any chance that this is because I also have opencv 2.2 instaled in my computer?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当您使用自定义 Find 宏来查找 opencv (CMakeModules/FindOpenCV.cmake) 时,您实际上应该检查该宏需要查找哪些库。由于看起来这个宏实际上在您的控制之下,因此我只需将调试消息添加到其处理中以找出它在哪个点失败。如果宏使用对 MARK_AS_ADVANCED 的调用,一个好的策略可以是打印出传递到该宏的所有变量。所有变量都必须有一个不为空、不为 false 或 XXX-NOTFOUND 的值。
除此之外,让我们可以使用这个 find 宏的代码将有助于调试。
As you are using a custom Find macro to find opencv (CMakeModules/FindOpenCV.cmake) you should actually check which libraries this macro requires to find. As it looks like this macro is actually under your control, I would just add debug messages to its processing to find out at which point it fails. If the macro uses a call to MARK_AS_ADVANCED a good strategy could be print out all variables that are passed into this macro. All variables need to have a value that is not empty, false or XXX-NOTFOUND.
Apart from that, making the code of this find macro available to us would help in debugging.