I did exactly what was written here: Easiest way to convert int to string in C++
But I get an error at the std of std::to_string
#include <iostream>
#include <string>
int main()
{
std::string s = std::to_string(42);
return 0;
}
I did exactly what was written here: Easiest way to convert int to string in C++
But I get an error at the std of std::to_string
#include <iostream>
#include <string>
int main()
{
std::string s = std::to_string(42);
return 0;
}
The error message you get can't be generated for a standard-conforming library implementation.
So, the best solution is to upgrade the compiler (presumably it's some years old Visual C++).
An alternative is to use an argument of type long
, and hope that that's one of the existing overloads:
std::to_string( 42L )