错误一:
Linking CXX executable ../../bin/opencv_createsamples
../../lib/libopencv_core.so: undefined reference to `clock_gettime'
../../lib/libopencv_highgui.so: undefined reference to `_TIFFerrorHandler'
../../lib/libopencv_highgui.so: undefined reference to `_TIFFrealloc'
../../lib/libopencv_core.so: undefined reference to `pthread_key_create
解决方法:
修改CMakeCache.txt,CMAKE_EXE_LINKER_FLAGS原来为空,加上-lpthread -lrt,重新编译,错误消除
错误二:
Linking CXX executable ../../bin/opencv_createsamples
../../lib/libopencv_highgui.so: undefined reference to `_TIFFerrorHandler'
../../lib/libopencv_highgui.so: undefined reference to `_TIFFrealloc'
../../lib/libopencv_highgui.so: undefined reference to `_TIFFmalloc'
../../lib/libopencv_highgui.so: undefined reference to `_TIFFmemcpy'
../../lib/libopencv_highgui.so: undefined reference to `TIFFOpen'
../../lib/libopencv_highgui.so: undefined reference to `_TIFFfree'
../../lib/libopencv_highgui.so: undefined reference to `_TIFFwarningHandler'
../../lib/libopencv_highgui.so: undefined reference to `_TIFFmemcmp'
../../lib/libopencv_highgui.so: undefined reference to `_TIFFmemset'
解决方法:修改CMakeCache.txt,WITH_TIFF:BOOL=ON,改成OFF,重新编译,错误消除。
#make install
三、测试
测试程序:
#include <cv.h>
#include <cxcore.h>
#include <highgui.h>
int main(int argc,char **argv)
{
CvCapture* capture = NULL;
IplImage* frame = NULL;
if(!(capture = cvCaptureFromCAM(-1)))
{
fprintf(stderr, "Can not open camera./n");
return -1;
}
cvNamedWindow("video", 1);
while(frame = cvQueryFrame( capture ) )
{
cvShowImage("video", frame);
}
cvDestroyWindow("video");
cvReleaseCapture(&capture);
return 0;
}
编译:
#arm-linux-g++ -o opencv_test opencv_test.cpp -I /usr/local/include -L /usr/local/lib -lopencv_core -lopencv_highgui -lpthread -lrt
单个opencv的make就花了大概1个半小时,终于成功了,但是这只是开始,要想运用opecv+qt+x264+ffmpeg做东西,这还需要更长远的学习啊
