error: ‘to_string’ was not declared in this scope

error:

error: ‘to_ string’ was not declared in this scope

reason:

to_ String is a new function introduced by C + + 11, which may not be supported by the old compiler, so we need to add “C + + 11” compiler support to the compiler

solutions:

gcc compiler under Linux: add the compiler option - STD = C + + 11 to the G + + command line, for example:

g++ -o test test.cpp -std=c++11

CodeBlocks compiler: toolbar opens settings – > Compiler, check C + + 11 standard here( (reference link)

dev C + + compiler: click Tools – > With compile options and the enclosed compiler instructions, the compiler can support the C + + 11 standard( (reference link)

Similar Posts: