fedora 15 安装opencv2.2时出现undefined reference to `cvCreateCameraCapture_V4L(int)'问题及其解决方法
2011-07-22 12:26
836 查看
在Fedora 15 下编译OpenCV 2.2
进行到7%左右时出现"ptrdeff_t"未定义都错误,考虑到之前在Fedora 14下编译没问题,可能是内核升级后头文件包含出现变动,所以才没有包含进stddef.h头文件。找到出错文件,就我的情况而言是:OpenCV-2.2.0/modules/core/include/opencv2/core/core.hpp
在该文件的合适位置加上语句:
#include<stddef.h>
继续编译,到81%左右出现了undefined reference to `cvCreateCameraCapture_V4L(int)'错误.
参考 https://code.ros.org/trac/opencv/ticket/324
In some linux distros where V4L2 is enabled, CMake does not define the H***E_CAMV4L macro, but the macro H***E_CAMV4L2 is defined.
When the highgui.so is building and linked with an other program, a Link error undefined reference to cvCreateCameraCapture_V4L is detected, and the library is not finished. The compilation terminated at [ 83%] Building.
解决方法(推荐使用第二种方法):
实际上就是修改第174行。
参考文献
http://blog.csdn.net/moc062066/article/details/6616902
https://code.ros.org/trac/opencv/ticket/324
http://www.eefocus.com/DSP_geek/blog/10-12/200665_09816.html
进行到7%左右时出现"ptrdeff_t"未定义都错误,考虑到之前在Fedora 14下编译没问题,可能是内核升级后头文件包含出现变动,所以才没有包含进stddef.h头文件。找到出错文件,就我的情况而言是:OpenCV-2.2.0/modules/core/include/opencv2/core/core.hpp
在该文件的合适位置加上语句:
#include<stddef.h>
继续编译,到81%左右出现了undefined reference to `cvCreateCameraCapture_V4L(int)'错误.
参考 https://code.ros.org/trac/opencv/ticket/324
In some linux distros where V4L2 is enabled, CMake does not define the H***E_CAMV4L macro, but the macro H***E_CAMV4L2 is defined.
When the highgui.so is building and linked with an other program, a Link error undefined reference to cvCreateCameraCapture_V4L is detected, and the library is not finished. The compilation terminated at [ 83%] Building.
解决方法(推荐使用第二种方法):
下载的源代码里面找到OpenCV-2.2.0/modules/highgui/src/cap_v4l.cpp
old | new | |
---|---|---|
214 | 214 | #include <sys/types.h> |
215 | 215 | #include <sys/mman.h> |
216 | 216 | |
217 | #ifdef H***E_CAMV4L //我们自己加上去 | |
217 | 218 | #include <linux/videodev.h> |
219 | #endif //我们自己加上去 | |
218 | 220 | |
219 | 221 | #include <string.h> |
220 | 222 | #include <stdlib.h> |
[code]下载的源代码里面找到OpenCV-2.2.0/modules/highgui/src/cap.cpp
old | new | |
---|---|---|
171 | 171 | if (capture) |
172 | 172 | return capture; |
173 | 173 | #endif |
174 | //把本行后面的删掉,就变成本行下面的一行#if defined (H***E_CAMV4L) || defined (H***E_CAMV4L2) | |
174 | #if defined (H***E_CAMV4L) | |
175 | 175 | capture = cvCreateCameraCapture_V4L (index); |
176 | 176 | if (capture) |
177 | 177 | return capture; |
参考文献
http://blog.csdn.net/moc062066/article/details/6616902
https://code.ros.org/trac/opencv/ticket/324
http://www.eefocus.com/DSP_geek/blog/10-12/200665_09816.html
相关文章推荐
- libhighgui.so: undefined reference to `cvCreateCameraCapture_V4L(int)'
- linux 下安装opencv3.0在编译时出现的问题undefined reference to `parallel_pthreads_set_threads_num(int)'
- Linux 编译报错 -- undefined reference to 问题解决方法 (具体'pthread_create'和opencv看文章最后两条)
- linux下开发,解决cocos2d-x中编译出现的一个小问题, undefined reference to symbol 'pthread_create@@GLIBC_2.2.5'
- 使用opencv 2.2静态库时: undefined reference to `clock_gettime' 链接错误问题解决
- ffmpeg libx264编译出现error: undefined reference to 'x264_picture_init'等问题的解决方法
- PHP 5.3.10 编译安装时出现 undefined reference to `libiconv' 错误的解决方法
- Linux下运行多线程——undefined reference to 'pthread_create'问题两种解决方法
- error: undefined reference to `cv::imread(cv::String const&, int)'问题解决方法
- openCV中 libopencv-nonfree-dev的安装: undefined reference to `cv::initModule_nonfree()'
- undefined reference to 'pthread_create' 问题解决
- undefined reference to 'pthread_create'问题解决
- 怎样彻底解决"undefined reference to `pthread_create'"问题
- undefined reference to 'pthread_create'问题解决
- 解决 linux下使用eclipse调用gdal 出现undefined reference to `GDALAllRegister'问题
- 编译错误----undefined reference to 'pthread_create'问题解决
- 用gcc编译.cpp文件可能出现"undefined reference to `__gxx_personality_v0'"问题的解决
- 出现undefined reference to `forkpty' 错误解决方法
- undefined reference to 'pthread_create'问题解决
- undefined reference to 'pthread_create'问题解决