Re: intptr_t has a previous declaration compile error

Le mardi 08 juillet 2008 à 00:01 -0500, Mike Brown a écrit :
> Platform: Solaris 10 x86
> GCC: Reading specs from /usr/sfw/lib/gcc/i386-pc-solaris2.10/3.4.3/specs
>      Configured with: /builds/sfw10-gate/usr/src/cmd/gcc/gcc-3.4.3/configure --prefix=/usr/sfw --with-as=/usr/sfw/bin/gas --with-gnu-as --with-ld=/usr/ccs/bin/ld --without-gnu-ld --enable-languages=c,c++ --enable-shared
>      Thread model: posix
>      gcc version 3.4.3 (csl-sol210-3_4-branch+sol_rpath)
> gmake used
> 
> Error: gmake[1]: Entering directory `/usr/local/src/amaya-fullsrc-10.1-pre2/Amaya/Sol10/amaya'
> gmake[2]: Entering directory `/usr/local/src/amaya-fullsrc-10.1-pre2/Amaya/Sol10/batch'
> g++ '-DCPP="'"gcc -E -x c"'"' -O2 -Wall -x c++ -D__cplusplus -D_UNIX -D_GL -D_WX -DNODISPLAY -DHAVE_CONFIG_H -I.. -I../../batch/f -I../../thotlib/include -I../../thotlib/internals/var -I../../thotlib/internals/h -I../../thotlib/internals/f
>   -I/usr/local/src/amaya-fullsrc-10.1-pre2/wxWidgets/src/png -I/usr/local/src/amaya-fullsrc-10.1-pre2/wxWidgets/src/jpeg -I/usr/local/src/amaya-fullsrc-10.1-pre2/wxWidgets/src/tiff -I/usr/local/src/amaya-fullsrc-10.1-pre2/Amaya/Sol10/wxWidgets_RELEASE/lib/wx/include/gtk2-unicode-release-static-2.8 -I/usr/local/src/amaya-fullsrc-10.1-pre2/wxWidgets/include -I/usr/local/src/amaya-fullsrc-10.1-pre2/wxWidgets/contrib/include -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -pthreads -D_REENTRANT -c ../../batch/../thotlib/base/compilmsg.c -o ../thotlib/base/compilmsg.o
> In file included from ../../batch/../thotlib/base/compilmsg.c:16:
> .../../thotlib/include/thot_sys.h:257: error: conflicting declaration 'typedef long int intptr_t'
> /usr/include/sys/int_types.h:104: error: 'intptr_t' has a previous declaration as `typedef int intptr_t'
> .../../thotlib/include/thot_sys.h:257: error: declaration of `typedef long int intptr_t'
> /usr/include/sys/int_types.h:104: error: conflicts with previous declaration `typedef int intptr_t'
> .../../thotlib/include/thot_sys.h:257: error: declaration of `typedef long int intptr_t'
> /usr/include/sys/int_types.h:104: error: conflicts with previous declaration `typedef int intptr_t'
> gmake[2]: *** [../thotlib/base/compilmsg.o] Error 1
> gmake[2]: Leaving directory `/usr/local/src/amaya-fullsrc-10.1-pre2/Amaya/Sol10/batch'
> gmake[1]: *** [../bin/str] Error 2
> gmake[1]: Leaving directory `/usr/local/src/amaya-fullsrc-10.1-pre2/Amaya/Sol10/amaya'

The __intptr_t_defined or _INTPTR_T_DEFINED variables are tested before
defining intptr_t. I suspect "/usr/include/sys/int_types.h" doesn't post
these variables:

#if !defined(__intptr_t_defined) && !defined(_INTPTR_T_DEFINED)
#define __intptr_t_defined
typedef           long   intptr_t;
#endif

You can add a test either on the platform or on another set variable.
Let me know the change you propose so I can include it for next
releases.

> The web page had the following note: "An error when compiling a C file occurred.
>        This should not be the case on any of the supported platform:"
>        
> Never say anything like that, as I will prove it wrong, as shown above :-) :-)

It was true when only a limited set of platforms was supported, but
you're right we cannot guaranty that today. I'll remove the sentense.

> 
> MB
-- 
Irene Vatton <Irene.Vatton@inria.fr>
INRIA

Received on Tuesday, 8 July 2008 07:16:06 UTC