mardi 3 novembre 2015

Cygwin: g++ 5.2: ‘to_string’ is not a member of ‘std’

The following simple program can't be compiled in cygwin with gcc

#include <string>
#include <iostream>

int main()
{
  std::cout << std::to_string(4) << std::endl;
  return 0;
}

Command line:

$ g++ -std=c++0x to_string.cc

Error:

to_string.cc: In function ‘int main()’:
to_string.cc:6:16: error: ‘to_string’ is not a member of ‘std’
   std::cout << std::to_string(4) << std::endl;

G++ version:

$ g++ --version
g++ (GCC) 5.2.0
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

The same code can be compiled in Ubuntu.

Is it possible at all compile this code with cygwin or I need to write a workaround?

Aucun commentaire:

Enregistrer un commentaire