Does 4.x supports wchar_t/wstring?

Jeremy Messenger mezz7 at cox.net
Wed May 12 01:59:15 PDT 2004


On Tue, 11 May 2004 20:08:00 +1000, Tim Robbins <tjr at freebsd.org> wrote:

> On Tue, May 11, 2004 at 04:06:40AM -0500, Jeremy Messenger wrote:
>> Hello,
>>
>> Current, I am having the problem with the games/wesnoth build on 4.x 
>> only.
>> I tried to get it builds w/ GCC 3.3, but still no luck. It shows that
>> _GLIBCPP_USE_WCHAR_T is not defined, so I am wondering if there has any
>> workaround for it?
> ...
>> The fail is location on language.hpp 61/62 line:
>> =============================================
>> std::string wstring_to_string(const std::wstring &);
>> std::wstring string_to_wstring(const std::string &);
>> =============================================
>
> It looks like the definition of the std::wstring class is commented out 
> on
> FreeBSD 4 because <cwctype> is missing. You could try adding this 
> wherever
> necessary:
> 	#include <cwchar>
> 	typedef basic_string<wchar_t> std::wstring;
>
> It will work for most simple things, but not stream I/O.

Thanks! Above didn't work, but I tweaked a little by using namespace and 
it compiles fine. Also, the game ran fine. I added looks like this:

=============================================
#if (__FreeBSD_version < 500029)
#include <cwchar>
namespace std
{
	typedef basic_string <wchar_t> wstring;
}
#endif
=============================================

Cheers,
Mezz

> Another workaround is to uncomment the definition in g++/string, un-#if 0
> the definition of string_char_traits <wchar_t> in g++/std/straits.h,
> change the #include line preceding it to <cctype>, and change iswspace() 
> to
> isspace(). This is not as much of a hack as it sounds, since the 4.4BSD 
> ctype
> functions accept wide characters, but it's obviously not something a port
> should be doing.
>
>
> Tim



-- 
mezz7 at cox.net  -  mezz at FreeBSD.org
bsdforums.org 's moderator, mezz.


More information about the freebsd-stable mailing list