Re: time.h, included from videodev2.h

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Hey Thomas,

On Fri, 2003-03-28 at 10:03, Thomas Højgaard Allin wrote:
> In file included from /usr/include/linux/videodev2.h:17,
>                   from videograb.c:6:
> /usr/include/linux/time.h:9: redefinition of `struct timespec'
> /usr/include/linux/time.h:17: redefinition of `struct timeval'
> make: *** [videograb] Error 1
[..]
> The program include directives are as follows:
> #include <stdio.h>
> #include <fcntl.h>
> #include <sys/ioctl.h>
> #include <linux/videodev2.h>

The problem is as follows: $(includedir)/linux/time.h defines the
structures timespec/timeval, without actually checking for whether these
are already defined (doh until here) by looking at the POSIX defines
_STRUCT_TIMEVAL ($(includedir)/bits/time.h) or __timespec_defined
($(includedir)/time.h), all included in $(includedir)/sys/time.h, which
is included by $(includedir)/sys/types.h, which is basically included
everywhere (this is all recursive). Conclusion: they're already defined,
posix defines are used to tell us this, but $(includedir)/linux/time.h
doesn't look at them.

This means, basically, that $(includedir)/linux/time.h, is buggered.
Since it only contains structures and types that are needed either in
kernel only or are defined elsewhere (in the posix
$(includedir)/{sys/,bits/,}*.h includes), the best way to solve this (in
my opinion) is just to make $(includedir)/linux/time.h not be used, so
just define that you already included it:

/* your own includes */
#include <stdio.h>
#include <fcntl.h>
#include <sys/ioctl.h>

/* we don't want linux/time.h */
#define _LINUX_TIME_H 1
#include <linux/videodev2.h>

I use this hack myself... It's the best solution I can think of for now.
It would even be better if $(includedir)/linux/time.h gets fixed, but I
guess this will do for now.

Ronald

-- 
Ronald Bultje <rbultje@xxxxxxxxxxxxxxxxxxx>
Linux Video/Multimedia developer





[Index of Archives]     [Linux DVB]     [Video Disk Recorder]     [Asterisk]     [Photo]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Free Photo Albums]     [Fedora Users]     [Fedora Women]     [ALSA Users]     [ALSA Devel]     [Linux USB]

Powered by Linux