-3

Whenever I try using the function stoi() , I get the error “ Use of undeclared identifier ’stoi’ “. So, is it something I have to include in my code or what?

1 Answers1

3

To use the std::stoi function you need to #include <string>.

If you don't include the header declaring the function you use, the compiler has no idea what you are trying to call.

This has nothing to do with your IDE btw (CLion or something else). That's just basic C++. Include what you use.

Jesper Juhl
  • 30,449
  • 3
  • 47
  • 70