I've been trying to compile the example code for V4L2 capturing but it just won't seem to work.
This is the url: http://v4l2spec.bytesex.org/v4l2spec/capture.c
I've got everything needed as far as I know to compile. The error is:
Code:
jonface@x64:~/Desktop$ gcc -o cap capture.c
In file included from capture.c:25:
/usr/include/linux/videodev2.h:552: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘v4l2_std_id’
/usr/include/linux/videodev2.h:635: error: expected specifier-qualifier-list before ‘v4l2_std_id’
/usr/include/linux/videodev2.h:653: error: expected specifier-qualifier-list before ‘v4l2_std_id’
/usr/include/linux/videodev2.h:690: error: expected specifier-qualifier-list before ‘v4l2_std_id’
If I try this:
Code:
jonface@x64:~/Desktop$ gcc -I /usr/src/linux-headers-2.6.17-11/include/asm-i386/ -o cap capture.c
In file included from /usr/src/linux-headers-2.6.17-11/include/asm-i386/fcntl.h:1,
from capture.c:14:
/usr/include/asm-generic/fcntl.h:117: error: expected specifier-qualifier-list before ‘off_t’
/usr/include/asm-generic/fcntl.h:140: error: expected specifier-qualifier-list before ‘loff_t’
In file included from capture.c:25:
/usr/include/linux/videodev2.h:552: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘v4l2_std_id’
/usr/include/linux/videodev2.h:635: error: expected specifier-qualifier-list before ‘v4l2_std_id’
/usr/include/linux/videodev2.h:653: error: expected specifier-qualifier-list before ‘v4l2_std_id’
/usr/include/linux/videodev2.h:690: error: expected specifier-qualifier-list before ‘v4l2_std_id’
capture.c: In function ‘errno_exit’:
capture.c:50: error: ‘errno’ undeclared (first use in this function)
capture.c:50: error: (Each undeclared identifier is reported only once
capture.c:50: error: for each function it appears in.)
capture.c:50: warning: implicit declaration of function ‘strerror’
capture.c:50: warning: format ‘%s’ expects type ‘char *’, but argument 5 has type ‘int’
capture.c: In function ‘xioctl’:
capture.c:63: error: ‘errno’ undeclared (first use in this function)
capture.c: In function ‘read_frame’:
capture.c:83: warning: implicit declaration of function ‘read’
capture.c:84: error: ‘errno’ undeclared (first use in this function)
capture.c:103: warning: implicit declaration of function ‘memset’
capture.c:103: warning: incompatible implicit declaration of built-in function ‘memset’
capture.c: In function ‘mainloop’:
capture.c:194: error: ‘errno’ undeclared (first use in this function)
capture.c: In function ‘start_capturing’:
capture.c:249: warning: incompatible implicit declaration of built-in function ‘memset’
capture.c:270: warning: incompatible implicit declaration of built-in function ‘memset’
capture.c: In function ‘init_mmap’:
capture.c:340: warning: incompatible implicit declaration of built-in function ‘memset’
capture.c:347: error: ‘errno’ undeclared (first use in this function)
capture.c: In function ‘init_userp’:
capture.c:399: warning: incompatible implicit declaration of built-in function ‘memset’
capture.c:406: error: ‘errno’ undeclared (first use in this function)
capture.c: In function ‘init_device’:
capture.c:443: error: ‘errno’ undeclared (first use in this function)
capture.c:483: warning: incompatible implicit declaration of built-in function ‘memset’
capture.c: In function ‘close_device’:
capture.c:545: warning: implicit declaration of function ‘close’
capture.c: In function ‘open_device’:
capture.c:558: error: ‘errno’ undeclared (first use in this function)
capture.c:558: warning: format ‘%s’ expects type ‘char *’, but argument 5 has type ‘int’
capture.c:567: warning: implicit declaration of function ‘open’
capture.c:571: warning: format ‘%s’ expects type ‘char *’, but argument 5 has type ‘int’
I'm really not sure what is going on but I would be interested to hear if anyone else can get it to compile. V4L is working as far as I know (webcam is working).
Thanks.
Bookmarks