g++ veresion 3.3.2 on HP-UX IA 11.23 sets STDC_EXT

Ryan Hadley rhadley@interlinknetworks.com
Fri Dec 5 14:26:00 GMT 2003


HP responded.  They say that a standard conforming C++ compiler should 
define __cplusplus greater than 199707L.  g++ defines it to 1.  Because 
of this, you have to add the flag -D_INCLUDE_LONGLONG.

It compiled just fine with -D_INCLUDE_LONGLONG, and that seems to me to 
be better than undefining __STDC_EXT__...  but I don't know much.

-Ryan

Ryan Hadley wrote:
> Hello,
> 
> I'm working on a HP-UX IA box:
> 
> $ uname -a
> HP-UX t06 B.11.23 U ia64 2438279764 unlimited-user license
> 
> With gcc 3.3.2:
> 
> $ gcc --version
> gcc (GCC) 3.3.2
> Copyright (C) 2003 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions.  There is 
> NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR 
> PURPOSE.
> 
> When I try to compile this file:
> 
> #include <net/if.h>
> 
> int main()
> {
> }
> 
> With gcc, everything works fine.  But if I use g++, not ok:
> 
> $ g++ -c test.c -o test
> 
> In file included from test.c:1:
> /usr/include/net/if.h:181: error: 'uint64_t' is used as a type, but is 
> not defined as a type.
> 
> But, if I use g++ with "-U__STDC_EXT__" (or -mlp64, but I need -milp32 
> to work), it works:
> 
> $ g++ -U__STDC_EXT__ -c test.c -o test
> 
> <command line>:4:1: warning: undefining "__STDC_EXT__"
> $
> 
> The problem seems to be with a line in net/if.h:
> 
> /* Note: The extended flags field "ifru_xflags" is a uint64_t which is not
>  * a valid type for strict ANSI C compilation for ILP32. Applications that
>  * need access to extended flags field should be compiled in extended ANSI
>  * (-Ae) or LP64 mode.
>  */
> 
> #if defined(__STDC_EXT__) || defined(__LP64__)
> 
> Is there a better way to do this than by undefining __STDC_EXT__?  Or is 
> it be safe to undefine that?  I've tried searching google and these 
> mailing lists with no luck...  Or should I be sending this question to HP?
> 
> Thanks-
> Ryan
> 




More information about the Gcc-help mailing list