c++ - to_string不存在问题
伊谢尔伦
伊谢尔伦 2017-04-17 14:17:56
0
2
354

提示:

D:C programLightOjmain.cpp|8|error: 'to_string' is not a member of
'std'|

这是代码:

// to_string example
#include <iostream>   // std::cout
#include <string>     // std::string, std::to_string
int main ()
{
  std::string pi = "pi is " + std::to_string(3.1415926);
  std::string perfect = std::to_string(1+2+4+7+14) + " is a perfect number";
  std::cout << pi << '\n';
  std::cout << perfect << '\n';
  return 0;
}

IDE是code::blocks,请问这个是为什么呢?

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all(2)
Peter_Zhu

Check your compiler version to see if it supports c++11 features and whether it supports this new standard library function

PHPzhong

Try setting it in the codeblock to compile according to c++11. The setting method is http://www.360doc.com/content... .
If it still doesn’t work, it should be because the compiler doesn’t support it as mentioned above

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template