wstring support

Bernhard Reutner-Fischer rep.dot.nop at gmail.com
Fri Jul 19 10:50:56 UTC 2013


On 19 July 2013 09:56, Manuel Sahm <Manuel.Sahm at feig.de> wrote:
> Hi,
>
> is there a wstring support in uclibc ?

I suppose you mean in uClibc++.

> If yes, how can I enable it ?

Yes, but IIRC it's experimental. Enable it via experimental wchar support:
$ grep WC .config
UCLIBCXX_HAS_WCHAR=y
UCLIBCXX_SUPPORT_WCIN=y
UCLIBCXX_SUPPORT_WCOUT=y
UCLIBCXX_SUPPORT_WCERR=y
# UCLIBCXX_SUPPORT_WCLOG is not set

>
> I only found the "Wide character support", but this didn´t solve my
> problem.
>
> I included <vector>, <string> and using namespace std.
> But it doesn´t work.
>
> If I try to compile my sourcecode, I always get:
>
> ...
> error: 'wstring' in namespace 'std' does not name a type
> error: 'wstring' does not name a type

Works for me:
$ cat wstring.cc
#include <string>
#include <iostream>
int main(void) {
int errors = 0;
std::wstring ws(L"a wstring");
std::wcout << ws << std::endl;
if (ws.find(L"x") != std::wstring::npos) {
errors++;
std::cerr << "ERROR: Thinks there is an x" << std::endl;
}
return errors > 0;
}
$ WRAPPER_INCLUDEDIR=-I$PWD/include WRAPPER_LIBDIR=-L${PWD}/src
./bin/g++-uc -o ws wstring.cc -lgcc_s && LD_LIBRARY_PATH=$PWD/src ./ws
; echo $?
a wstring
0
$

Expect some rough edges, tested patches, including corresponding
testcases are welcome.
I point you to
http://cxx.uclibc.org/faq
http://uclibc.org/developing#contrib

thanks,


More information about the uClibc mailing list