I recently had this error with netbeans 8.0.2 on OS X, and couldn't find an answer for what to do.
I solved the problem by uninstalling the C/C++ plug-in, when I reopened netbeans it prompted me to 'fix code assistance..'.
Clicking the prompt and letting it run the problem was fixed.