4

I am using Code::Blocks 16.01 and running the following code produces an error: 'to_string' was not declared in this scope

#include <iostream>
#include <string>

using namespace std;

int main() {
    long int i = 10000000;
    cout << to_string(i);
    return 0;
}

Note: Already ticked "Have g++ follow the C++11 ISO C++ language standard" in compiler flags.

nole
  • 563
  • 1
  • 5
  • 16
  • Which os and compiler? – iksemyonov Feb 18 '16 at 13:37
  • 4
    http://stackoverflow.com/a/12975602/1981581 – odyss-jii Feb 18 '16 at 13:38
  • If you did indeed [set Code Blocks to use C++11](https://stackoverflow.com/questions/18174988/how-can-i-add-c11-support-to-codeblocks-compiler) then your code should work fine as written. – Cory Kramer Feb 18 '16 at 13:38
  • 1
    Windows 10 and GNU GCC Compiler which was included in codeblocks. – nole Feb 18 '16 at 13:39
  • This seems to be a duplicate, as pointed out in the comment by @odyss-jii . I could confirm the error on my old installation of CodeBlocks on Windows. According to [this answer](http://stackoverflow.com/a/31767452/4770166), installing a more recent compiler version should help. – RHertel Feb 18 '16 at 14:03

0 Answers0