gcc 3.0 - wchar_t redeclared?

Pavel Novy novy@feld.cvut.cz
Wed Sep 5 03:10:00 GMT 2001

Phil Edwards wrote:

>On Tue, Sep 04, 2001 at 12:56:11PM +0200, Pavel Novy wrote:
>>Phil Edwards wrote:
>>>That's never a good sign.  Try not using -B.
>>Basically, I don't want to use no built-ins and I really don't know why 
>>it's there and how to omit those specs. However, the problem is in 
>>cc1plus and I don't see nothing wrong on parameters passed (generated 
>>automatically from gcc parameters):
>> ../../bin/cc1plus.exe -fpreprocessed cpp.ii -quiet -dumpbase cpp.cpp 
>>-O2 -Wall -version -fno-builtin -fshort-enums -fpack-struct 
>>-fpcc-struct-return -fno-implicit-templates -fno-exceptions -fno-rtti -o 
>>GNU CPP version 3.0.1 (cpplib) (i386 Linux/ELF)
>>GNU C++ version 3.0.1 (i386-pc-linux-gnu)
>>        compiled by GNU C version 2.95.3-5 (cygwin special).
>>In file included from cpp.cpp:1:
>>u:/ndk/nwsdk/include/nlm/stdio.h:34: redeclaration of C++ built-in type
>>   `wchar_t'
>>MAKE: *** [cpp.o] Error 1
>In C, wchar_t is required to be a typedef.  In C++, it's a builtin type.
Okay Phil, now I see it more clearly.

>Your headers files must not redeclare those builtin types.
Not mine, but Novell's... As I don't want to touch SDK headers or the 
sources, I can solve the issue using the following ways (in the Makefile):
1. with "-D_WCHAR_T" compiler option (usable with gcc 3.0+ only or with 
C++ sources where wchar_t is not needed)
2. with "-include gcc30.h" compiler option; gcc30.h:

#ifdef __cplusplus
  #if __GNUC__==3
    #define _WCHAR_T

>Good luck with the -B option and your own setup.
Thanks. I am building NetWare loadable modules with gcc+binutils GNU 
stuff on Linux and Win32 platforms, so with the fix I can finally kick 
gcc 2.95.x off...

>>I have had no problems with earlier versions (2.95.2, 2.95.3-x) of gcc 
>>compiled and used that way. The same (changed) behaviour on Linux with 
>>gcc 3.0+.
>Yes, 3.0 is far more complient to the C++ standard than 2.x was.
Could you point me to some docs, where I can read more about this C++ 
standard or about gcc compliance with this one?
I can then request a fix in Novell's SDK ;-).


More information about the Gcc-bugs mailing list