I am trying to break my C++Builder habit by switching to Eclipse and gcc for future development but I'm finding it hard to get started. I've installed Eclipse mars and tdm-gcc-5.1.0-3.
I've created a simple Hello world program from the new project wizard.
#include <iostream>
#include <string>
using namespace std;
int main() {
cout << "!!!Hello World " << endl; // prints !!!Hello World!!!
return 0;
}
This compiles and runs fine.
I modified it to use to_string and it still works
cout << "!!!Hello World " << to_string(1) << endl; // prints !!!Hello World!!! 1
Now I got really fancy and changed it to use widestrings.
wcout << L"!!!Hello World " << to_wstring(1) << endl; // should print !!!Hello World!!! 1
but I get the following compiler error
g++ -std=c++0x -O0 -g3 -Wall -c -fmessage-length=0 -o "src\\hello.o" "..\\src\\hello.cpp"
..\src\hello.cpp: In function 'int main()':
..\src\hello.cpp:14:45: error: 'to_wstring' was not declared in this scope
wcout << L"!!!Hello World " << to_wstring(1) << endl; // should print !!!Hello World!!! 1
despite the fact that every online source I can find says that to_wstring is part of c++11.
I've searched in the tdm-gcc folders and found to_wstring defined in include\c++\bits\basic_string.h, which is referenced from string.h, so it should be visible to my code.
Is there something else I need to include to get this to work, or is it a switch I need to set somewhere? I really need wide strings for my project.