Eclipse CDT "Symbol NULL could not be resolved"

As Bob mentioned, i fix the bug just by rebuilt the index

  1. right your project
  2. choose "Index"
  3. choose "Rebuild"

NULL is usually defined in stddef.h. This file is also usually included with stdlib.h and stdio.h.

And, you could always do this:

#ifndef NULL
#define NULL   ((void *) 0)
#endif

I had the same problem: my makefile was running fine but I was getting errors like yours from the Eclipse CDT view.

I closed the current project, I opened a new "Makefile project with existing code" , specifying the right location source location of my project. After this, I checked that: right click project / C++ general / Paths and symbols / Gnu C++ / include directories is not empty and includes the correct paths of my project.

Then, I rebuilt the index (right click / index / rebuild).

Also, I use Eclipse CDT 7 and not Eclipse CDT 8 because CDT8 sometimes gives me compile errors from the GUI that I could not solve, eventhough the makefile was fine.