I'm trying to compile this example code
#include <iostream> // std::cout
#include <string> // std::string, std::stod
int main ()
{
std::string orbits ("365.24 29.53");
std::string::size_type sz; // alias of size_t
double earth = std::stod (orbits,&sz);
double moon = std::stod (orbits.substr(sz));
std::cout << "The moon completes " << (earth/moon) << " orbits per Earth year.\n";
return 0;
}
Trying to compile from the command prompt gives
C:\Users\DWane\Documents>g++ -std=c++0x testme.cpp -o out.exe
testme.cpp: In function 'int main()':
testme.cpp:9:18: error: 'stod' is not a member of 'std'
double earth = std::stod (orbits,&sz);
^
testme.cpp:10:17: error: 'stod' is not a member of 'std'
double moon = std::stod (orbits.substr(sz));
^
I'm running Windows 8 64bit and have g++ (GCC) 4.8.3.