Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 May 2004 03:59:50 -0500
From:      Jeremy Messenger <mezz7@cox.net>
To:        Tim Robbins <tjr@freebsd.org>
Cc:        freebsd-stable@freebsd.org
Subject:   Re: Does 4.x supports wchar_t/wstring?
Message-ID:  <opr7vpx0ev8ckrg5@smtp.central.cox.net>
In-Reply-To: <20040511100800.GA34687@cat.robbins.dropbear.id.au>
References:  <opr7tvlels8ckrg5@smtp.central.cox.net> <20040511100800.GA34687@cat.robbins.dropbear.id.au>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 11 May 2004 20:08:00 +1000, Tim Robbins <tjr@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@cox.net  -  mezz@FreeBSD.org
bsdforums.org 's moderator, mezz.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?opr7vpx0ev8ckrg5>