The undefined reference to 'cvcreatecameracapture _ v4l (INT) 'problem occurred during the installation of opencv2.2 on fedora 15 and its Solution

Source: Internet
Author: User

Compile opencv 2.2 in fedora 15

At around 7%, the "ptrdeff_t" undefined error occurs. Considering that the compilation in fedora 14 is normal, it may be because the header file contains changes after the kernel upgrade, so it is not included in stddef. h header file. Find the error file, in my case: OpenCV-2.2.0/modules/CORE/include/opencv2/CORE. HPP
Add the following statement to the proper position of the file:

# Include <stddef. h>

Continue to compile. An undefined reference to 'cvcreatecameracapture _ v4l (INT) 'error occurs around 81%.

Reference https://code.ros.org/trac/opencv/ticket/324

In some Linux distros where v4l2 is enabled, cmake does not define the have_camv4l macro, but the macro have_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.

Solution (the second method is recommended ):

Find the OpenCV-2.2.0/modules/highgui/src/cap_v4l.cpp In the downloaded source code.
Old New  
214 214 # Include <sys/types. h>
215 215 # Include <sys/Mman. h>
216 216  
  217 # Ifdef have_camv4l// Add them by ourselves
217 218 # Include <Linux/videodev. h>
  219 # Endif// Add them by ourselves
218 220  
219 221 # Include <string. h>
220 222 # Include <stdlib. h>

Find the OpenCV-2.2.0/modules/highgui/src/cap. cpp in the downloaded source code.
Old New  
171 171 If (capture)
172 172 Return capture;
173 173 # Endif
174   // Delete the row after the row and convert it to the row below the row # If defined (have_camv4l)| Defined (have_camv4l2) 
  174 # If defined (have_camv4l) 
175 175 Capture = cvcreatecameracapture_v4l (INDEX );
176 176 If (capture)
177 177 Return capture;

Actually, it is to modify the 174th rows.

References

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.