Does 4.x supports wchar_t/wstring?

Tim Robbins tjr at freebsd.org
Tue May 11 03:08:54 PDT 2004


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.

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


More information about the freebsd-stable mailing list