I'm trying to program a RPN Calculator for Linux. I'm saving the input to a string, because I want the user to be able to type things like "quit", for example. However: I'm getting an error at this section of code:
string input;
// Between here there's input and operator checking, so yes, input is initialized.
try {
reg1 = strtod(input, NULL); // reg1 here is of type double
// Note that I'm using strtod instead of stod, because stod does not work for me either.
} catch(invalid_argument) {
cout << "Please enter a number" << endl;
continue;
}
The error is:
'invalid_argument' in namespace 'std' does not name a type.
Yes, I have #include <string>
and I also have using namespace std;
I've also tried to write std::invalid_argument
instead, but I'm getting the same error. I also have c++11 enabled for compilation and I think I'm using MinGW g++ 4.9.2, but I'm not sure. It's basically the g++ compiler that comes with Code::Blocks.
If more code is required, I'll post it here.
Aucun commentaire:
Enregistrer un commentaire