g++ not finding <stddef.h> via <cstddef>

Bernd Jendrissek bernd.jendrissek@gmail.com
Mon Aug 11 18:30:00 GMT 2008


Now that I'm not hanging off a GPRS connection, I can search:

I seem to be bumping into the same / a related issue to the following:

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=492817
http://gcc.gnu.org/ml/gcc/2001-09/msg00032.html
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36505

Although it's in the debian bug database, I'm using the vanilla GCC
4.3.1 tarball.

Should I file a PR or is it PEBKAC?  If it isn't just me being a n00b
and misconfiguring GCC, what's the easiest / most standards-friendly
workaround?  I'm tempted to just s/include_next/include/ in the
installed C++ headers for now.

Pinski's comment on #36505 seems to suggest it's PEBKAC... but where
am I supposed to get /usr/include/stddef.h?  The system is fairly old
and is based on some 2001 Debian, and has glibc 2.3.1 IIRC.  Sigh...
I'm *really* not in the mood for building glibc.

On Sat, Aug 9, 2008 at 3:08 AM, Bernd Jendrissek
<bernd.jendrissek@gmail.com> wrote:
> I was chasing down why gettext wouldn't build and found CXX= : in one of
> its generated Makefiles, and it turns out g++ can't see <cstddef> whilst
> it *can* see <stddef.h>.  gcc can also see <stddef.h>
>
> Can anyone tell me in what way exactly my system is misconfigured, and
> what I can do to make #include <cstddef> work?
>
> [On my system, /usr/local is a symlink to /home/newdisk/usr-local, hence
> the funny paths being visible.]
>
> berndj@localhost:/tmp$ cat /tmp/foo.cpp
> #include <stddef.h>
>
> int main()
> {
> }
> berndj@localhost:/tmp$ g++ -v /tmp/foo.cpp -o /tmp/a.out
> Using built-in specs.
> Target: i686-pc-linux-gnu
> Configured with: ../gcc-4.3.1/configure --enable-__cxa_atexit --enable-shared --disable-static --with-gxx-include-dir=/usr/local/include/c++/4.3.1 --enable-languages=c,c++,fortran,objc,treelang
> Thread model: posix
> gcc version 4.3.1 (GCC)
> COLLECT_GCC_OPTIONS='-v' '-o' '/tmp/a.out' '-shared-libgcc' '-mtune=generic'
>  /home/newdisk/usr-local/bin/../libexec/gcc/i686-pc-linux-gnu/4.3.1/cc1plus -quiet -v -iprefix /home/newdisk/usr-local/bin/../lib/gcc/i686-pc-linux-gnu/4.3.1/ -D_GNU_SOURCE /tmp/foo.cpp -quiet -dumpbase foo.cpp -mtune=generic -auxbase foo -version -o /tmp/ccpO11fe.s
> ignoring nonexistent directory "/home/newdisk/usr-local/bin/../lib/gcc/i686-pc-linux-gnu/4.3.1/../../../../i686-pc-linux-gnu/include"
> ignoring duplicate directory "/home/newdisk/usr-local/bin/../lib/gcc/../../lib/gcc/i686-pc-linux-gnu/4.3.1/include"
> ignoring duplicate directory "/home/newdisk/usr-local/bin/../lib/gcc/../../lib/gcc/i686-pc-linux-gnu/4.3.1/include-fixed"
> ignoring nonexistent directory "/home/newdisk/usr-local/bin/../lib/gcc/../../lib/gcc/i686-pc-linux-gnu/4.3.1/../../../../i686-pc-linux-gnu/include"
> #include "..." search starts here:
> #include <...> search starts here:
>  /home/newdisk/usr-local/bin/../lib/gcc/i686-pc-linux-gnu/4.3.1/include
>  /home/newdisk/usr-local/bin/../lib/gcc/i686-pc-linux-gnu/4.3.1/include-fixed
>  /home/newdisk/usr-local/bin/../lib/gcc/../../include/c++/4.3.1
>  /home/newdisk/usr-local/bin/../lib/gcc/../../include/c++/4.3.1/i686-pc-linux-gnu
>  /home/newdisk/usr-local/bin/../lib/gcc/../../include/c++/4.3.1/backward
>  /usr/local/include
>  /usr/include
> End of search list.
> GNU C++ (GCC) version 4.3.1 (i686-pc-linux-gnu)
>        compiled by GNU C version 4.3.1, GMP version 4.2.1, MPFR version 2.2.1.
> GGC heuristics: --param ggc-min-expand=90 --param ggc-min-heapsize=113195
> Compiler executable checksum: 43dc44fca57738655f9116114f886dc1
> In file included from /tmp/foo.cpp:1:
> /home/newdisk/usr-local/bin/../lib/gcc/../../include/c++/4.3.1/cstddef:48:25: error: stddef.h: No such file or directory
> In file included from /tmp/foo.cpp:1:
> /home/newdisk/usr-local/bin/../lib/gcc/../../include/c++/4.3.1/cstddef:55: error: '::ptrdiff_t' has not been declared
> /home/newdisk/usr-local/bin/../lib/gcc/../../include/c++/4.3.1/cstddef:56: error: '::size_t' has not been declared
>
> The only [excluding those in directories for other versions & targets of
> GCC] <stddef.h> on my system are:
>
> /usr/include/linux/stddef.h
> /usr/local/lib/gcc/i686-pc-linux-gnu/4.3.1/include/stddef.h
>
> TIA



More information about the Gcc-help mailing list