-2

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; } 
3

1 Answer 1

2

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 ) 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.