* wstring and gcc
@ 2002-09-25 11:30 andy
2002-09-29 16:16 ` andy
0 siblings, 1 reply; 6+ messages in thread
From: andy @ 2002-09-25 11:30 UTC (permalink / raw)
To: gcc-help
I'm running gcc 3.2 on a redhat linux box.
this simple code :
int main()
{
wstring foo;
printf("%s\n",foo.c_str());
return 0;
}
produces the following link error:
"
/tmp/cceNYHXk.o: In function `main':
/tmp/cceNYHXk.o(.text+0x18): undefined reference to
`std::basic_string<wchar_t, std::char_traits<wchar_t>,
std::allocator<wchar_t> >::basic_string[in-charge]()'
/tmp/cceNYHXk.o(.text+0x23): undefined reference to
`std::basic_string<wchar_t, std::char_traits<wchar_t>,
std::allocator<wchar_t> >::c_str() const'
/tmp/cceNYHXk.o(.text+0x3e): undefined reference to
`std::basic_string<wchar_t, std::char_traits<wchar_t>,
std::allocator<wchar_t> >::~basic_string [in-charge]()'
/tmp/cceNYHXk.o(.text+0x51): undefined reference to
`std::basic_string<wchar_t, std::char_traits<wchar_t>,
std::allocator<wchar_t> >::~basic_string [in-charge]()'
collect2: ld returned 1 exit status"
since gcc 3.2 is in my home directory, the command line to build the app is
as follows:
/home/andy/tools3.2/H-i686-pc-linux-gnu/bin/gcc -o tstapp test.cpp -static
-lstdc++
Any help in resolving this is greatly appreciated
Andy
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: wstring and gcc
2002-09-25 11:30 wstring and gcc andy
@ 2002-09-29 16:16 ` andy
2002-09-30 8:15 ` Gokhan Kisacikoglu
0 siblings, 1 reply; 6+ messages in thread
From: andy @ 2002-09-29 16:16 UTC (permalink / raw)
To: gcc-help
No responses so far. Nobody knows or wrong list?
If the latter, where should I post it ?
Thx
Andy
> I'm running gcc 3.2 on a redhat linux box.
>
> this simple code :
> int main()
> {
> wstring foo;
> printf("%s\n",foo.c_str());
> return 0;
> }
>
> produces the following link error:
> "
> /tmp/cceNYHXk.o: In function `main':
> /tmp/cceNYHXk.o(.text+0x18): undefined reference to
> `std::basic_string<wchar_t, std::char_traits<wchar_t>,
> std::allocator<wchar_t> >::basic_string[in-charge]()'
> /tmp/cceNYHXk.o(.text+0x23): undefined reference to
> `std::basic_string<wchar_t, std::char_traits<wchar_t>,
> std::allocator<wchar_t> >::c_str() const'
> /tmp/cceNYHXk.o(.text+0x3e): undefined reference to
> `std::basic_string<wchar_t, std::char_traits<wchar_t>,
> std::allocator<wchar_t> >::~basic_string [in-charge]()'
> /tmp/cceNYHXk.o(.text+0x51): undefined reference to
> `std::basic_string<wchar_t, std::char_traits<wchar_t>,
> std::allocator<wchar_t> >::~basic_string [in-charge]()'
> collect2: ld returned 1 exit status"
>
> since gcc 3.2 is in my home directory, the command line to build the app is
> as follows:
> /home/andy/tools3.2/H-i686-pc-linux-gnu/bin/gcc -o tstapp test.cpp -static
> -lstdc++
>
> Any help in resolving this is greatly appreciated
> Andy
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: wstring and gcc
2002-09-29 16:16 ` andy
@ 2002-09-30 8:15 ` Gokhan Kisacikoglu
2002-10-03 9:21 ` andy
0 siblings, 1 reply; 6+ messages in thread
From: Gokhan Kisacikoglu @ 2002-09-30 8:15 UTC (permalink / raw)
To: andy; +Cc: gcc-help
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: wstring and gcc
2002-09-30 8:15 ` Gokhan Kisacikoglu
@ 2002-10-03 9:21 ` andy
2002-10-03 10:22 ` Gokhan Kisacikoglu
0 siblings, 1 reply; 6+ messages in thread
From: andy @ 2002-10-03 9:21 UTC (permalink / raw)
To: gcc-help
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: wstring and gcc
2002-10-03 9:21 ` andy
@ 2002-10-03 10:22 ` Gokhan Kisacikoglu
2002-10-03 12:09 ` andy
0 siblings, 1 reply; 6+ messages in thread
From: Gokhan Kisacikoglu @ 2002-10-03 10:22 UTC (permalink / raw)
To: andy; +Cc: gcc-help
andy wrote:
>
> I got it to work.Basicaly, I just needed to enable wchar support in
> libstdc++.
Does this mean you can either use the wide or normal characters, or
simply it is an configuration issue to support them both?
Gokhan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: wstring and gcc
2002-10-03 10:22 ` Gokhan Kisacikoglu
@ 2002-10-03 12:09 ` andy
0 siblings, 0 replies; 6+ messages in thread
From: andy @ 2002-10-03 12:09 UTC (permalink / raw)
To: gcc-help
The wide char support is determined by the system, I believe.
The configure script looks for wchar support in the system headers and turns
off the libc++ macros if it doesn't find it there.
In my particular case, I'm on a machine with a rather old kernel and I
installed gcc3 in my home directory and not in /usr
So maybe a combination of the above resulted in the problem
Andy
On 10/3/02 10:20 AM, "Gokhan Kisacikoglu" wrote:
> andy wrote:
>>
>> I got it to work.Basicaly, I just needed to enable wchar support in
>> libstdc++.
>
>
> Does this mean you can either use the wide or normal characters, or
> simply it is an configuration issue to support them both?
>
> Gokhan
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2002-10-03 19:09 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-25 11:30 wstring and gcc andy
2002-09-29 16:16 ` andy
2002-09-30 8:15 ` Gokhan Kisacikoglu
2002-10-03 9:21 ` andy
2002-10-03 10:22 ` Gokhan Kisacikoglu
2002-10-03 12:09 ` andy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).