Search code examples
clinuxubuntu-12.04header-files

Linux header files giving syntax error


On trying to compile a program using gcc I get the following error.

In file included from /usr/include/unistd.h:218:0, from fcfssched.c:3: /usr/include/x86_64-linux-gnu/bits/types.h:31:1:

error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘typedef’

The error appears to be in the header file /bits/types.h

The second error is (probably) a result of the first.

In file included from /usr/include/stdlib.h:320:0, from fcfssched.c:5: /usr/include/x86_64-linux-gnu/sys/types.h:34:1:

error: unknown type name ‘__u_char’

How do I solve this ?

The header file appears to be fine. I just updated the headers using the libc6-dev package. I am using Ubuntu 12.04 x86 with Kernel 3.2.0-36-generic


Solution

  • This kind of error generally occurs in case of syntax error around the include directive in the user code.

    You should have a look in your sources if there is not a missing ; or } near the include which falls by including /bits/types.h (following the inclusion tree).