Ask Your Question
0

Error in Opencv instation (error: field 'cap' has incomplete type)

asked 2016-04-04 11:08:36 -0600

I tried to install OpenCV several times but always returns the same error. I'm running Linux - Debian in Beaglebone Black.

The configuration is:

root@beaglebone:~# uname -a
Linux beaglebone 3.8.13-bone79 #1 SMP Tue Oct 13 20:44:55 UTC 2015 armv7l GNU/Linux

Someone told me that the error is proplably in the code of OpenCV - in GitHub. The command that I used to clone openCV was:

 git clone https://github.com/Itseez/opencv_contrib.git

The flags that I used in Cmake were:

cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D OPENCV_EXTRA_MODULES_PATH=/home/nathan/opencv_contrib/modules/ \
-D INSTALL_C_EXAMPLES=ON \

The error is:

[ 54%] Building CXX object modules/videoio/CMakeFiles/opencv_videoio.dir/src/cap_gstreamer.cpp.o
[ 54%] Building CXX object modules/videoio/CMakeFiles/opencv_videoio.dir/src/cap_libv4l.cpp.o
/home/nathan/opencv/modules/videoio/src/cap_libv4l.cpp:329:27: error: field 'cap' has incomplete type
/home/nathan/opencv/modules/videoio/src/cap_libv4l.cpp:330:22: error: field 'inp' has incomplete type
/home/nathan/opencv/modules/videoio/src/cap_libv4l.cpp:331:23: error: field 'form' has incomplete type
/home/nathan/opencv/modules/videoio/src/cap_libv4l.cpp:332:21: error: field 'crop' has incomplete type
/home/nathan/opencv/modules/videoio/src/cap_libv4l.cpp:333:24: error: field 'cropcap' has incomplete type
/home/nathan/opencv/modules/videoio/src/cap_libv4l.cpp:334:31: error: field 'req' has incomplete type
/home/nathan/opencv/modules/videoio/src/cap_libv4l.cpp:335:32: error: field 'compr' has incomplete type
/home/nathan/opencv/modules/videoio/src/cap_libv4l.cpp:336:24: error: field 'control' has incomplete type
/home/nathan/opencv/modules/videoio/src/cap_libv4l.cpp:338:26: error: field 'queryctrl' has incomplete type
 /home/nathan/opencv/modules/videoio/src/cap_libv4l.cpp: In function 'int try_init_v4l2(CvCaptureCAM_V4L*, char*)':
 /home/nathan/opencv/modules/videoio/src/cap_libv4l.cpp:488:5: error: 'CvCaptureCAM_V4L' has no member named 'cap'
 /home/nathan/opencv/modules/videoio/src/cap_libv4l.cpp:488:5: error: 'CvCaptureCAM_V4L' has no member named 'cap'
/home/nathan/opencv/modules/videoio/src/cap_libv4l.cpp:1823:24: error: 'V4L2_BUF_TYPE_VIDEO_CAPTURE' was not declared in this scope
/home/nathan/opencv/modules/videoio/src/cap_libv4l.cpp:1824:42: error: 'VIDIOC_STREAMOFF' was not declared in this scope
/home/nathan/opencv/modules/videoio/src/cap_libv4l.cpp:1827:64: error: 'CvCaptureCAM_V4L' has no member named 'req'
.... a lot of lines
[ 54%] /home/nathan/opencv/modules/videoio/src/cap_libv4l.cpp: In function 'double icvGetPropertyCAM_V4L(CvCaptureCAM_V4L*, int)':
/home/nathan/opencv/modules/videoio/src/cap_libv4l.cpp:1495:1: error: control reaches end of non-void function [-Werror=return-type]
Building CXX object modules/photo/CMakeFiles/opencv_photo.dir/src/align.cpp.o
cc1plus: some warnings being treated as errors
make[2]: *** [modules/videoio/CMakeFiles/opencv_videoio.dir/src/cap_libv4l.cpp.o] Error 1
make[1]: *** [modules/videoio/CMakeFiles/opencv_videoio.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 54%] Building CXX object modules/photo/CMakeFiles/opencv_photo.dir/opencl_kernels_photo.cpp.o
Linking CXX shared library ../../lib/libopencv_photo.so
[ 54%] Built target opencv_photo
make: *** [all] Error 2
root@beaglebone:/home/nathan/opencv/build#

I follow the steps in this site : http ... (more)

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2016-04-04 11:29:09 -0600

Giorgos_ts gravatar image

You are only installing the contrib package . Not the whole library. Try this :

sudo apt-get install build-essential

sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev

sudo mkdir /opt/opencv-3.1.0

cd /opt/opencv-3.1.0

sudo git clone https://github.com/Itseez/opencv.git

sudo git clone https://github.com/Itseez/opencv_cont...

cd /opt/opencv-3.1.0/opencv sudo git checkout 3.1.0

cd /opt/opencv-3.1.0/opencv_contrib sudo git checkout 3.1.0

sudo mkdir /opt/opencv-3.1.0/opencv/release

cd /opt/opencv-3.1.0/opencv/release

sudo apt-get install qt5-default

sudo cmake -D CMAKE_BUILD_TYPE=RELEASE -DWITH_OPENGL=ON -DWITH_QT=ON -D CMAKE_INSTALL_PREFIX=/usr/local -D OPENCV_EXTRA_MODULES_PATH=/opt/opencv-3.1.0/opencv_contrib/modules ..

sudo make

sudo make install

pkg-config --modversion opencv

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2016-04-04 11:08:36 -0600

Seen: 683 times

Last updated: Apr 04 '16