size_t can not be found by g++-4.1 or others on Ubuntu 8.1

EdH picture EdH · Jul 10, 2009 · Viewed 33.2k times · Source

This has happened before to me, but I can't remember how I fixed it.

I can't compile some programs here on a new Ubuntu install... Something is awry with my headers.

I have tried g++-4.1 and 4.3 to no avail.

g++ -g -frepo  -DIZ_LINUX -I/usr/include/linux -I/usr/include -I/include  -c qlisttest.cpp
/usr/include/libio.h:332: error: ‘size_t’ does not name a type
/usr/include/libio.h:336: error: ‘size_t’ was not declared in this scope
/usr/include/libio.h:364: error: ‘size_t’ has not been declared
/usr/include/libio.h:373: error: ‘size_t’ has not been declared
/usr/include/libio.h:493: error: ‘size_t’ does not name a type
/usr/include/stdio.h:294: error: ‘size_t’ has not been declared
...

the file...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
...



@ubuntu:~/work/zpk/src$ cat /usr/include/linux/types.h | grep size_t
typedef __kernel_size_t    size_t;
typedef __kernel_ssize_t   ssize_t;

types.h is definitely in the path, and is getting picked up. I verified by changing the file name and get an error its missing...

Does anyone have any ideas...? I would really appreciate the help...

Answer

Vladimir Prus picture Vladimir Prus · Jul 10, 2009

Start by removing -I/usr/include/linux and -I/usr/include. Adding system directories to include paths manually either has no effect, or breaks things. Also, remove -frepo for extra safety.