For Programmers: Free Programming Magazines  


Home > Archive > Unix Programming > October 2006 > wstring usage









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author wstring usage
jithu

2006-10-30, 7:15 pm

Hi
Could any one tell me how to compile the code using wstring with
g++ or gcc. I am using gcc version 3.4.2

#include<iostream>
#include<string>
using namespace std;

int main()
{
std::wstring str("ABC");
return 0;

}

This is the error message i got when i compiled the code

g++ program.cpp
wstring.cpp:7: no matching function for call to
`std::basic_string<wchar_t, std::char_traits<wchar_t>,
std::allocator<wchar_t>>::basic_string(const

char[4])'

Thanks in Advance
Kiran Pradeep

Maxim Yegorushkin

2006-10-30, 7:15 pm


jithu wrote:
> Hi
> Could any one tell me how to compile the code using wstring with
> g++ or gcc. I am using gcc version 3.4.2
>
> #include<iostream>
> #include<string>
> using namespace std;
>
> int main()
> {
> std::wstring str("ABC");
> return 0;
>
> }
>
> This is the error message i got when i compiled the code
>
> g++ program.cpp
> wstring.cpp:7: no matching function for call to
> `std::basic_string<wchar_t, std::char_traits<wchar_t>,
> std::allocator<wchar_t>>::basic_string(const
>
> char[4])'


std::wstring str(L"ABC");

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com