How do you define "wstring"?

I am getting an error while building in Ubuntu

. And the error is as follows:

ISO C++ forbids declaration of `wstring' with no type

      

To solve this problem I have to define myself wstring

. So who knows how to determine wstring

?

+3


source to share


1 answer


To use wstring

, you must add #include<string>

and preferably use its full name std::wstring

.

UPDATE: In case your compiler doesn't support it for some reason std::wstring

, you can try the following typedef

(taken directly from bits/string_fwd.h

and configured to add the missing one std::

).

typedef std::basic_string<wchar_t> wstring;

      



Note that it depends on the wchar_t

defined and according to this :

In C ++, wchar_t is a separate fundamental type (and therefore not defined in any other header).

If your compiler doesn't support wchar_t

there is no (easy) way to define it as far as I know.

0


source







All Articles