Using wxWindows with GTK2 for Unicode support.
I've just finished converting my app to use Unicode internally rather than
ASCII or any of the other primitive character types :) . To do this I had
to create a helper function to handle conversions from the wxWindows
wxString class to Mozilla's string classes (using a const PRUnichar* for
the transition, since they all seem to take that in their assign methods).
Now, all of a sudden, where I wasn't having any linking problems before, I'm
having this problem:
./../wxMozilla/libwxmozilla.a(webString.o):/home/dfancella/webilator/wxMozilla/webString.cpp:21:
undefined reference to `typeinfo for nsAutoString'
I dug out the libstring_s.a and libstring_obsolete_s.a files and linked to
them. That didn't work, so I dug out all the .cpp string files, added them
to the project and compiled them. Compiled fine (of course), same linker
error.
Presumably my app now requires nsAutoString in some fashion (in the helper
function I created, in fact, that's webString.o in the error message) where
it didn't before.
Here's the source for the webString.cpp file:
const PRUnichar* webString(wxString& instring)
{
const wxWX2MBbuf tmp_buf = wxConvCurrent->cWX2MB(instring.wc_str());
const char *tmp_str = (const char*) tmp_buf;
return NS_ConvertUTF8toUCS2(tmp_str).get();
}
Obviously it's just one function declaration. As you can see, there isn't
any obvious need for nsAutoString, but the NS_ConvertUTF8toUCS2 class could
be using it.
So, heh, how do I resolve the linker error? My first choice is to find the
appropriate library and link to it. It occurs to me that the error could
be caused by crappy code on my part, but I can't for the life of me seem to
pick out where it would be. What can I link to to get nsAutoString type
info for the linker?
Dave