Il seguente programma semplice non può essere compilato in Cygwin con gccCygwin: g ++ 5.2: 'to_string' non è un membro di 'std'
#include <string>
#include <iostream>
int main()
{
std::cout << std::to_string(4) << std::endl;
return 0;
}
Riga di comando:
$ g++ -std=c++0x to_string.cc
errore :
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;
versione G ++:
$ 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.
Lo stesso codice può essere compilato in Ubuntu.
È possibile compilare questo codice con cygwin o è necessario scrivere una soluzione alternativa?
Potrebbe essere necessario utilizzare '-std = C++ 11' invece di' -std = C++ 0x' – NathanOliver
@NathanOliver lo stesso risultato. – Alex
Hai controllato quale intestazione '' viene utilizzata? –