gcc 3.0 - wchar_t redeclared?

Pavel Novy novy@feld.cvut.cz
Tue Sep 4 03:57:00 GMT 2001


Hello Phil,

Phil Edwards wrote:

>On Mon, Sep 03, 2001 at 06:05:24PM +0200, Pavel Novy wrote:
>
>>Hi,
>>since gcc 3.0 I am experiencing the following issue when compiling any 
>>C++ source code with Novell NDK headers included:
>>
>>../../bin/gcc.exe -c -save-temps -v -B ../../bin/ -I../../include 
>>
>
>Why are you using -B here?
>
I am using self-compiled gcc from the sources (under Cygwin, on Linux 
too) and using only the gcc, cpp0, cc1 and cc1plus binaries placed in a 
separate directory (that's why I'm using -B option) - nothing else. 
Using the following command in my makefile:

../../bin/gcc.exe -c -save-temps -B ../../bin/ -I../../include 
-Iu:/ndk/nwsdk/include -Iu:/ndk/nwsdk/include/nlm 
-Iu:/ndk/nwsdk/include/nlm/winsock  -DN_PLAT_NLM -nostdinc -fno-builtin 
-O2 -Wall -fshort-enums -fpack-struct -fpcc-struct-return 
-fno-implicit-templates -fno-exceptions -fno-rtti cpp.cpp -o cpp.o

Basically, I don't want to use no built-ins. 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+. Tested without the 
"-fno-builtin" option on older gcc and it seems it doesn't matter here 
(compilation succeeded).

>>Using builtin specs.
>>
>
>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 
cpp.s
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

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+.

Man gcc says:
-Bprefix
              This option specifies where to  find  the  executables,  
libraries and data files of the compiler it self.

... and I have nothing else then gcc and binutils executables under 
../../bin .

>
>>Configured with: ./configure --target=i386-pc-linux-gnu
>>
>
>You need to read the installation instructions, specifically the part about
>"we highly recommend building the compiler in a separate build directory."
>
I did so (called .../gcc-3.0.1/configure --target=... from a separate 
subdirectory). Produced executables are a bit different, but the same 
results when compiling C++ source.

>
>>Is it a bug in gcc 3.0+? Or, could it be solved by some compiler switch?
>>
>
>Try not using -B.
>
It's needed to run my own executables, so it can't be ommited here. I've 
tried to place them to the same directory where compiled source is 
located (run without -B, then), but it always result to the same error 
when running cc1plus. Also tried to rename my source from cpp.cpp to 
cpp.c (compiled with cc1 3.0.1, then) and it works fine (there is a 
definition of the wchar_t type in .i file too).

>
>Phil
>
Thanks for your time.

Best regards,
Pavel




More information about the Gcc-bugs mailing list