#if does not work!
Andrew Haley
aph@redhat.com
Sat Jun 21 12:14:00 GMT 2008
Unga wrote:
> --- On Sat, 6/21/08, Andrew Haley <aph@redhat.com> wrote:
>
> Here is a test case:
>
> #include <stdio.h>
> #include <float.h>
>
> main()
> {
> printf("%d\n", LDBL_MANT_DIG);
> }
>
>
> In float.h, the LDBL_MANT_DIG is defined as:
> #define LDBL_MANT_DIG 64
>
> I compile the above test program as:
> gcc -I/tools/include -I/tools/usr/include -o test test.c
>
> ./test prints 53!!!!
>
> The reason is, it is not taking the float.h from /tools/usr/include,
> but from
> /tools/lib/gcc/i386-unknown-freebsd7.0/4.3.1/include/float.h .
Yeah, this is right: gcc sometimes needs its own fixed versions of standard headers.
> Rename the
> /tools/lib/gcc/i386-unknown-freebsd7.0/4.3.1/include/float.h to
> something else and compile the test.c and run prints 64.
>
> Programs I compile should get their header files only from
> /tools/include and /tools/usr/include.
Well, that would mean that you would not be able to access the
system's C library at all. Do I take it that you have an entire C
library installed in /tools? If so, that is a really weird thing to
do and I son't know where you're going with it.
> 1. How do I instruct the gcc to get headers only from directories I
> want?
Either provide full paths in your #include or use -nostdinc.
Try using #include "float.h" not #include <float.h>.
> 2. Do I need /tools/lib/gcc/i386-unknown-freebsd7.0/4.3.1/include/
> anymore? Can I either remove or rename after the gcc is installed?
You probably do, yes. But bypassing your system's C library's headers
is so fraught with potential problems it's hard to be sure.
Andrew.
More information about the Gcc-help
mailing list