lkml.org 
[lkml]   [2000]   [Feb]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Improper headers
On Sun, 27 Feb 2000 10:18:11 -0500, Shourya Sarcar wrote:
> The header files in /usr/include and /usr/include/linux seem o be rather
> inconsistent. The following code spews errors.
>
> test.c
>
> #include <time.h>
> #include <linux/time.h>
>
> int main() {}
>
> gcc -Wall test.c . Lots of errors.

In file included from foo.c:2:
/usr/include/linux/time.h:6: redefinition of `struct timespec'
foo.c: In function `main':
foo.c:4: warning: control reaches end of non-void function

The last warning is because you fail to return a value.

> One bypass would be to use any 1 of the headers but a problem is the
> following case :
>
> #include <foo.h> /* This in turn includes <time.h> */
> #include <moo.h> /* This in turn includes <linux/time.h> */
>
> Any workarounds ??

Just don't include linux/time.h. It is meant for _kernel_ use, not for
_userland_. If you really want to convert timespec to jiffies (I fail to
see why that would be useful in userland), just "#define _STRUCT_TIMESPEC"
before you include linux/time.h.


Erik

--
Feb 27 16:07:27 linux kernel: lp0 printer error
Feb 27 16:07:28 linux kernel: lp0 on fire
-- Linux kernel log



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:56    [W:0.051 / U:0.324 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site