wstring and gcc

andy andy@softbook.com
Wed Sep 25 11:30:00 GMT 2002


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



More information about the Gcc-help mailing list