   What the heck -- NULL undeclared?
  Now this has never happened to me.  I got this error today:error C2065: ''NULL'' : undeclared identifierThe code line it is complaining about is: if( pNode == NULL ) {which is just a simple NULL check.  Anybody else had this happen? 
  there is no such thing as NULL.NULL is #define-ed by windows headers. ;  maybe a #undef NULL sneaked in? Anyway just #define NULL 0  ;  I had a problem similar to this, and it took me forever to find it.  What happened to me was I had an opening brace and no closing one.  I was getting problems inside of stdio and everything.  I hope that helps!   It is coming...10 years in the making and It is finally coming-Beavt8r...;quote:Original post by alnite  there is no such thing as NULL.NULL is #define-ed by windows headers.   Um, no?NULL is defined in stdlib.h/cstdlib and is very much standard C and C++.Usually NULL being unrecognized means either (1) some VERY old legacy code has been screwing with the preprocessor, or (2) The compiler is very, very confused. ;  Maybe you simply don''t include any standard library files?  If not, then #define NULL 0 will do the trick.  Otherwise, like others have said, you probably have some random syntax error that''s totally screwing up the compiler. ;quote:Original post by Agony  Maybe you simply don''t include any standard library files? He''s using Visual Studio though (guessing from the look of the error message) which does you the "favor" of auto including header files, most notably stdlib.h. ;quote:Original post by Promit  quote:Original post by alnite   there is no such thing as NULL.NULL is #define-ed by windows headers.   Um, no?NULL is defined in stdlib.h/cstdlib and is very much standard C and C++.um...err....but it''s not a C/C++ standard keyword! ;quote:Original post by Promit  quote:Original post by Agony   Maybe you simply don''t include any standard library files? He''s using Visual Studio though (guessing from the look of the error message) which does you the "favor" of auto including header files, most notably stdlib.h.   You certain?  It might include some I''m unaware of, but try using rand() without manually including cstdlib and see what happens... ;quote:Original post by alnite  quote:Original post by Promit   Um, no?NULL is defined in stdlib.h/cstdlib and is very much standard C and C++.um...err....but it''s not a C/C++ standard keyword!   It''s not a keyword, but it''s an identifier with a clearly defined value, according to the Standard.  Whether it''s available for usage would depend on proper header inclusion.  I''m not convinced it''s in cstdlib (I think it''s more probably in cstddef), but I''m really not sure. 