Error with numeric_limits

Code

#include <iostream>

using namespace std;

int main() {
    cout << numeric_limits<int>::min() << endl;
}

Error

error: incomplete type 'std::numeric_limits<int>' used in nested name specifier

Question
I do not understand why I am getting an error with the

std::numeric_limits::min()

IDE
CLion 2020.3

I tried removing and adding the namespace. However, I remain speechless with the error as I am following one of the videos and it did not seem to require prior configuration.

I tried using Visual Studio with the same code and it worked perfectly fine.
I’m also wondering about the solution to this. Wonder if it is a complier problem…

You should add the include of the file containing this class.
On CLion try add on the top:

#include <limits>  

I think Mosh simply forgot to say this.

1 Like

Thanks a lot for the answer Anna !