This repository has been archived by the owner on Apr 8, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Fixing OpenCV 2.1.0 compile errors
Ashfaq edited this page Mar 24, 2015
·
1 revision
I have faced this problem every time I installed opencv 2.1.0. During building the makefile, some errors appear as follows and build terminates:
../../lib/libhighgui.so.2.1.0: undefined reference to `cvCreateCameraCapture_V4L(int)‘
collect2: ld returned 1 exit status
make[3]: *** [bin/opencv_createsamples] Error 1
Following files need to be changed to build successfully without any error.
OpenCV.2.1.0/cvconfig.h.cmake
OpenCV.2.1.0/src/highgui/cvcap.cpp
OpenCV.2.1.0/src/highgui/cvcap_libv4l.cpp
OpenCV.2.1.0/cvconfig.h.cmake
Search for these lines in the file
#cmakedefine HAVE_CAMV4L2
Add following lines after above line
/* V4L/V4L2 capturing support via libv4l */
#cmakedefine HAVE_LIBV4L
OpenCV.2.1.0/src/highgui/cvcap.cpp
Delete or comment the following line
#if defined (HAVE_CAMV4L) || defined (HAVE_CAMV4L2)
Replace with following expression
#if defined HAVE_LIBV4L || (defined (HAVE_CAMV4L) && defined (HAVE_CAMV4L2))
OpenCV.2.1.0/src/highgui/cvcap_libv4l.cpp
Replace
#if !defined WIN32 && defined HAVE_CAMV4L
with
#if !defined WIN32 && defined HAVE_LIBV4L
Search for
#include <linux/videodev.h>
Add #ifdef HAVE_CAMV4L just before it and #endif just after it.
Again Search for #include <linux/videodev2.h>
Add #ifdef HAVE_CAMV4L2 just before it and #endif just after it.
Reference: http://akashashwat.net23.net/?p=8