交叉编译opencv编译过程中的错误

opencv版本2.1可以使用cmake来配置。
不过首先需要安装cmake和cmake-gui工具。

在cmake-gui中配置好下载的opencv路径,然后在where to build the binaries中选中源码路径下,新建build目录,然后选中。

首先点击configure按钮,选择cross compile项,点击next,然后选择arm-linux-gcc,arm-linux-g++路径。
然后在主界面上,可以配置选项,例如如果v4l就在with项下,把v4l选中。
然后generate,就会生成makefile文件,
终端进入build目录,然后make,make install就完成了。

在编译的过程可能会出现一些错误,下面是我遇到的一些:


1、‘unlink’ was not declared in this scope
找到相应的文件,添加#include<unistd.h>

2、undefined reference to `cvCreateCameraCapture_V4L(int)'
解决方法:
src/highgui/cap_v4l.cpp


#include <sys/mman.h>
#ifdef HAVE_CAMV4L //加上去
#include <linux/videodev.h>
#endif //加上去
#include <string.h>


同目录下cvcap.cpp
找到if (capture)
return capture;
#endif
把#if defined (HAVE_CAMV4L) || defined (HAVE_CAMV4L2)
修改为#if defined (HAVE_CAMV4L)
capture = cvCreateCameraCapture_V4L (index);
if (capture)
return capture;
3、undefined reference to `clock_gettime'
vim CMakeCache.txt,修改build目录下的CMakeCache.txt,CMAKE_EXE_LINKER_FLAGS原来为空,加上-lpthread -lrt。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值