V4L2-标头不完整

问题描述

我想将V4L与C一起使用。

如果我遵循https://lwn.net/Articles/204545/上的教程并创建文件 main.c及其内容

#include <linux/videodev2.h>

这不能与gcc -std=c17一起编译。 它给出了错误 /usr/include/linux/videodev2.h:2320:20: error: field 'timestamp' has incomplete type

它确实可以与gcc -std=gnu11一起使用,但是我宁愿使用c17而不是gnu方言。 这是我可以期望的工作吗?我应该报告错误吗?我在哪里报告错误

我确实知道可以在<time.h>之前加入<linux/videodev2.h>,但似乎仍然有问题。

编辑: 可以减少与v4l无关但与linux标头(?)无关的问题。

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

对我来说,尚不清楚<sys/time.h>是否应包含struct timespec

解决方法

根据linux/videodev2.htimestampstruct timeval。依次是GNU C库扩展。