c++ - ‘numeric_limits’ was not declared in this scope, no matching function for call to ‘max()’ -


i compiled code @ home on mac w/ xcode , there no provblem. compile @ school g++ on linux , these errors:

:‘numeric_limits’ not member of std
:expected primary-expression before ‘>’ token
:no matching function call ‘max()’

#include <iostream> #include <cstdlib>  using namespace std;  int getintegerinput(int lower, int upper) {     int integer = -1;         {             cin >> integer;         cin.clear();         cin.ignore(std::numeric_limits<streamsize>::max(), '\n');  //errors here     }while (integer < lower || integer > upper);      return integer;     }  

i'm geussing maybe have include header. if take away std:: gives me similar error

‘numeric_limits’ not declared in scope

you need include header file <limits>, std::numeric_limits defined. mac compiler helping out automatically including header file; however, should not rely on behavior , explicitly include header files need.


Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -