简体   繁体   中英

V4L2 - Header incomplete

I wanted to use V4L with C.

If I follow the tutorial on https://lwn.net/Articles/204545/ and create a file main.c with the content

#include <linux/videodev2.h>

This does not compile with gcc -std=c17 . It gives the error /usr/include/linux/videodev2.h:2320:20: error: field 'timestamp' has incomplete type

It does work with gcc -std=gnu11 but I'd rather use c17 instead of a gnu dialect. Is this something I can expect to work? Should I report a bug? Where would I report a bug.

I do know that I can include <time.h> in before <linux/videodev2.h> but it still seems buggy.

Edit: The Issue can be reduced unrelated to v4l but to the linux headers(?).

#include <sys/time.h>
struct timespec x;

To me it is unclear if <sys/time.h> should include struct timespec or not.

According to linux/videodev2.h , timestamp is a struct timeval . Which in turn is a GNU C library extension.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM