tags:

views:

843

answers:

3

This is the compiler message (somewhat stripped):

/usr/include/sys/mman.h:145: error: 'mode_t' has not been declared

Another error:

In file included from /usr/include/sys/resource.h:25,
                 from /usr/include/sys/wait.h:32,
/usr/include/bits/resource.h:172: error: field 'ru_utime' has incomplete type
/usr/include/bits/resource.h:174: error: field 'ru_stime' has incomplete type

And another one:

In file included from /usr/include/sys/wait.h:32,
/usr/include/sys/resource.h:94: error: 'id_t' has not been declared
/usr/include/sys/resource.h:98: error: 'id_t' has not been declared

This is on Linux, GCC 4.3.1. Do you have any clues why these happen?

It turned out to be issue with system header include inside a namespace. After that GCC became crazy. If anyone encounters similar problem, don't be surprised when the solution is totally unrelated to error messages. And be very careful when finding the cause.

A: 

have you tried to #include <sys/stat.h> and <sys/types.h>?

Peter Miehle
Yes. It makes no difference. That's why it's so weird to me.
phjr
A: 

If these types are needed in e.g. the wait.h file, the types.h file should be included before including wait.h.

A way to investigate this: show the include tree your compiler generates for one of the offending compilation units. On Visual C++, this is the /showIncludes option. On gcc, I'm not so sure - it may be the -M option (which generates makefile-like output)

xtofl
For GCC it's -H. Still investigating...
phjr
A: 
#include <fcntl.h>
fizzer
No result. Doesn't help.
phjr