Reputation: 995
I have a problem with converting int
to string
in Dev-C++.
I have the proper #include
, but still I get:
[Error] 'to_string' is not a member of 'std'
const int MAX_KOSZT = 999999;
string convert(int val) {
if (val == MAX_KOSZT)
{
return "--";
}
else {
if (val < 10) {
return "0" + std::to_string(val);
}
else {
return std::to_string(val);
}
}
}
void getCout()
{
cout << convert(sciana) << "," << convert(chodnik);
}
Upvotes: 1
Views: 12738
Reputation: 431
The compiler defaults to not having C++11 features available.
I suspect you need to change the language standard to ISOC++11 or GNUC++11 in the compiler settings.
If you are using a project, you will find this in the project options (right click on the project). If not, you will find this, I think, in the "tools" menu.
The option you need looks something like this http://www.cplusplus.com/doc/tutorial/introduction/devcpp/devcpp2.png
Upvotes: 6