Even after defining nullptr compiler shows error “nullptr was not declared in this scope”. It can be confusing to understand. In this article, we are going to discuss this particular error.
Error and Cause
As I said above, even after declaring the nullptr it shows the error “nullptr was not declared in this scope”.
C++ evolved with time, c++ introduces new things to use from time to time. And the compiler helps us to convert our little piece of code into machine language. In our case, we should know that C++ introduces nullptr in C++11 and if our compiler does not support C++11 then it will show error “nullptr was not declared in this scope” even if you declare it.
In short: You see that error implies that whatever platform you are compiling on does not have C++11 support or does not have it enabled.
To resolve this issue, you have to either enable C++11 support in your compiler or if you cannot do this then change to a compiler that does support it.