asheeshr
asheeshr

Reputation: 4114

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

Upvotes: 1

Views: 3625

Answers (3)

user10609288
user10609288

Reputation:

Sometimes rearranging the header files helps. I fixed it replacing:

#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <xcb/xcb.h>
#include <QX11Info>
#include <iostream>
#include <list>
#include <QCoreApplication>

To:

#include <QX11Info>
#include <iostream>
#include <list>
#include <QCoreApplication>

#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <xcb/xcb.h>

If you are using other dev libs in C++ a lot, you some times need to make this job

Upvotes: 0

Vineet1982
Vineet1982

Reputation: 7918

This error generally comes when you missed the (;) or (}) in the coding line. Kindly check the each line of code written by you.

The best way to get the issue resolve is to start check the code reverse line by line from the error line received. Don't check the standard files included in the project. The error comes from the your coded file.

Upvotes: 1

greydet
greydet

Reputation: 5539

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).

Upvotes: 5

Related Questions