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