Skip to main content



      Home
Home » Language IDEs » C / C++ IDE (CDT) » INT_MAX was not declared in this scope/could not be resolved(Problem with INT_MAX in tutorial program)
INT_MAX was not declared in this scope/could not be resolved [message #1758044] Wed, 22 March 2017 19:35 Go to next message
Eclipse UserFriend
Hi. I am new to C++ and I am going through the Cave of Programming at udemy.com. The lesson is Integer Types.

The code is as follows:

//===================================================================
// Name        : Integer.cpp
//===================================================================

#include <iostream>
#include <limits>

using namespace std;

int main() {

	int value = 54656;
	cout << value << endl;

	cout << INT_MAX << endl;
	
	return 0;
}



I get an error at cout << INT_MAX << endl; that says "Symbol INT_MAX could not be resolved. The author of the tutorial mentions that some compilers may have an issue with <limits> and even suggested <limits.h> but either gives the same error.

Help!

Thanks



Re: INT_MAX was not declared in this scope/could not be resolved [message #1758138 is a reply to message #1758044] Thu, 23 March 2017 15:28 Go to previous messageGo to next message
Eclipse UserFriend
What you want is #include <climits> for INT_MAX
See: http://www.cplusplus.com/reference/climits/

You can use #include <limits> but it declares templates.
See the example: http://www.cplusplus.com/reference/limits/numeric_limits/
Re: INT_MAX was not declared in this scope/could not be resolved [message #1758150 is a reply to message #1758138] Thu, 23 March 2017 19:02 Go to previous message
Eclipse UserFriend
That was it. Thanks!

Now, more reading to do.

Thanks again.
Previous Topic:C++ programs beginners
Next Topic:Program file does not exist error when using SDL library
Goto Forum:
  


Current Time: Thu Sep 25 16:33:40 EDT 2025

Powered by FUDForum. Page generated in 0.03718 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top