I'm trying to compile a project on my university's ssh server and I get the error:
Node.h:12: error: ‘nullptr’ was not declared in this scope
Chunk of code from my Node.h class:
template <typename T>
struct Node{
T data;
Node *leftChild;
Node *rightChild;
Node(const T & theData = nullptr, Node *left = nullptr, Node *right = nullptr);
Node(T && theElement = nullptr, Node *left = nullptr, Node *right = nullptr);
T getData();
};
The server runs on GCC
version 4.4.7
and I'm compiling using the following command:
g++ -std=c++0x
^ I use this command for all of my projects for this class, and this is the first time I'm running into this issue. What can I try to resolve this?
nullptr
came into being in C++11, see en.cppreference.com/w/cpp/language/nullptr – Paul Sandersconst T & theData = nullptr
, your elements can only be pointers (ornullptr_t
). I doubt that it's what you want – you probably wantconst T & theData = T()
– molbdnilo