This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: wstring and gcc


I got it to work.Basicaly, I just needed to enable wchar support in
libstdc++.
Here's what I ended up doing:
-Built and installed the latest version of glibc. That in and of itself,is a
separate and painful adventure:-)

-Built gcc3.2 
When you build gcc,normally you'd have a directory called build-gcc or
something, where the configure script puts all the makefiles . As part of
gcc full build process,it builds the libstdc++-v3 library and puts it in a
platform specific directory( in my case it's called i686-pc-linux-gnu)
Inside libstdc++-v3 directory there's a file called config.h
I added the following definitions to it:
#define _GLIB_CPP_USE_WCHAR_T 1
#define _GLIB_CPP_HAVE_WCHAR_T  1

-Make clean and make install inside libstdc++-v3 directory
There were some compile errors  in the file libstdc++-v3/include/cwchar
There is a whole mess of #undefs that I had to comment out
starts with #undef btowc
and ends with #undef wscanf

Below that, there's a bunch of "using::xxx" of the functions undef'd above-
commented that out too.
Then, there's a routine wcschr that  needs to read:
{return wcschr(const_cast<wchar_t*>(--p),--c));} otherwise I got a compile
error.
I think that's it

Now the example I initially quoted builds and runs fine.
I think the reason for all this mess is that the configure script assumed
that my environment does not support wchar.
Maybe I did it in a boneheaded brute force kind of a way - any suggestions
how to achieve the same result in a more elegant fashion, are welcom

HTH
Andy


On 9/30/02 8:16 AM, "Gokhan Kisacikoglu"  wrote:

> This did not work for me either;
> 
> #include <string>
> 
> int main()
> {
>   std :: wstring foo;
>   return 0;
> }
> 
> %> g++ -o tt tt.cpp
> ld32: ERROR   33 : Unresolved text symbol "std::basic_string<wchar_t,
> std::char_traits<wchar_t>, std::allocator<wchar_t>
>> ::basic_string[in-charge]()" -- 1st referenced by /tmp/ccHkNfJj.o.
>       Use linker option -v to see when and which objects, archives and
> dsos are loaded. 
> ld32: ERROR   33 : Unresolved text symbol "std::basic_string<wchar_t,
> std::char_traits<wchar_t>, std::allocator<wchar_t> >::~basic_string
> [in-charge]()" -- 1st referenced by /tmp/ccHkNfJj.o.
>       Use linker option -v to see when and which objects, archives and
> dsos are loaded. 
> ld32: INFO    152: Output file removed because of error.
> collect2: ld returned 2 exit status
> 
> 
> What's that [in-charge] mean?
> 
> Gokhan


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]