mardi 25 juillet 2017

Error with compiling to_string

I wanted to use to_string function. I had problem, so I copied exapmle code from http://ift.tt/1DXatCp

// 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;
}

but when i try to build it in Geany there is error:

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

That's my build command:

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

Aucun commentaire:

Enregistrer un commentaire