C++ linux/videodev.h:没有这样的文件或目录 - ubuntu 11.04 上的 OpenCV
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5842235/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
linux/videodev.h : no such file or directory - OpenCV on ubuntu 11.04
提问by Niroshan
I tried to install OpenCV2.2 on Ubuntu 11.04. But OpenCV compilation fails stating an error related to linux/videodev.h file. File available in /user/includes/linux is named videodev2.h.
我尝试在 Ubuntu 11.04 上安装 OpenCV2.2。但是 OpenCV 编译失败,说明与 linux/videodev.h 文件相关的错误。/user/includes/linux 中可用的文件名为 videodev2.h。
/home/user/OpenCV-2.2.0/modules/highgui/src/cap_v4l.cpp:217:28: fatal error: linux/videodev.h: No such file or directory
compilation terminated.
make[2]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/src/cap_v4l.o] Error 1
make[1]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/all] Error 2
make: *** [all] Error 2
Is there a solution for this ?
有解决方案吗?
thank you.
谢谢你。
回答by bukzor
The current answer is incomplete. Installing libv4l-dev
creates a /usr/include/linux/videodev2.h
but doesn't solve the stated problem of not being able to find linux/videodev.h
. The library does ship header files for compatibility, but fails to put them where applications will look for them.
目前的答案是不完整的。安装libv4l-dev
会创建一个/usr/include/linux/videodev2.h
但不能解决无法找到linux/videodev.h
. 为了兼容性,该库确实提供了头文件,但未能将它们放在应用程序将要查找的位置。
sudo apt-get install libv4l-dev
cd /usr/include/linux
sudo ln -s ../libv4l1-videodev.h videodev.h
This provides a linux/videodev.h
, and of the right version (1).
这提供了linux/videodev.h
正确版本 (1)的, 和 。
回答by Alberto
sudo apt-get install libv4l-dev
Editing for RH based systems:
为基于 RH 的系统编辑:
On a Fedora 16 to install pygame 1.9.1 (in a virtualenv):
在 Fedora 16 上安装 pygame 1.9.1(在 virtualenv 中):
sudo yum install libv4l-devel
sudo ln -s /usr/include/libv4l1-videodev.h /usr/include/linux/videodev.h
回答by karlphillip
v4l support has been dropped in recent kernel versions (including the one shipped with Ubuntu 11.04).
最近的内核版本(包括随 Ubuntu 11.04 一起提供的内核版本)已取消对 v4l 的支持。
EDIT: Your question is connected to a recent messagethat was sent to the OpenCV users group, which has instructions to compile OpenCV 2.2 in Ubuntu 11.04. Your approach is not ideal.
编辑:您的问题与最近发送给 OpenCV 用户组的消息有关,该消息包含在 Ubuntu 11.04 中编译 OpenCV 2.2 的说明。你的方法并不理想。
回答by sujit
The patch is here: https://code.ros.org/trac/opencv/attachment/ticket/862/OpenCV-2.2-nov4l1.patch
补丁在这里:https: //code.ros.org/trac/opencv/attachment/ticket/862/OpenCV-2.2-nov4l1.patch
By adding #ifdef HAVE_CAMV4L
around
通过添加#ifdef HAVE_CAMV4L
周围
#include <linux/videodev.h>
in OpenCV-2.2.0/modules/highgui/src/cap_v4l.cpp
and removing || defined (HAVE_CAMV4L2)
from line 174
allowed me to compile.
inOpenCV-2.2.0/modules/highgui/src/cap_v4l.cpp
和 remove || defined (HAVE_CAMV4L2)
from line174
允许我编译。
回答by Vyacheslav
for CMake remove/disable with_libv4l
with_v4l
variables if you do not need this lib.
对于 CMake,with_libv4l
with_v4l
如果您不需要此库,请删除/禁用变量。