我想使用to_string
功能。
我有问题,所以我从http://www.cplusplus.com/reference/string/to_string/复制了exapmle代码
// 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;
}
但是当我尝试在Geany中构建它时出现错误:
c:/mingw/bin/../lib/gcc/mingw32/5.3.0/../../../libmingwex.a(vsnprintf.o):(.text+0x0): multiple definition of `vsnprintf'
C:\Users\Pancerni\AppData\Local\Temp\ccRxaX7q.o:test.cpp:(.text$vsnprintf[_vsnprintf]+0x0): first defined here
这是我的构建命令:
g++ -Wall -o "test" "test.cpp" -std=c++11