Possible Duplicate:
error: ‘NULL’ was not declared in this scope
i’m having this code, which has been written in visual studio but i`m working in eclipse and i’m trying to make it compilable for eclipse and i throws me this error
..\heap.cpp:104:10: error: 'NULL' was not declared in this scope
code:
#include"heap.h"
using namespace std;
template<class T>
Heap<T>::Heap() // constructor
{
root = NULL;
size = 0;
}
Eclipse isn’t a compiler, just an IDE. I’m guessing you’re using it with another compiler than Visual Studio and the system headers are somewhat different, leading to your VC++ working includes to not include the declaration of NULL on
<the other compiler>. As Martinho Fernandes said, you need to include<stdlib.h>or<cstdlib>, or some header that includes those ones. As the other question says, the C++ 11 way would be<stddef.h>or<cstddef>.