Eclipse CDT “Symbol NULL could not be resolved”

后端 未结 13 1812
北荒
北荒 2020-12-06 04:32

I just installed Eclipse CDT with MinGW. All the environment variables are set, includes, etc. Tried running a hello world and everyth

相关标签:
13条回答
  • 2020-12-06 04:39

    This problem is still coming up in 2019... there are many different causes/solutions.

    I was getting unresolved symbols in the editor for NULL and everything in stdio.h (stderr, printf etc.) but compile worked fine. Nothing helped until I went in project properties and deleted a bunch of unnecessary C/C++ include paths. After that reindexing fixed the problem.

    In another case I had an undefined symbol for a class name that was involved in some conditional preprocessor macro trickery. Adding the header file which defines the macro to "Index all variants of specific headers" in C/C++ indexer options (after checking "Enable project specific settings) fixed it.

    This shows the the eclipse CDT indexer can get confused easily.

    0 讨论(0)
  • 2020-12-06 04:42

    I just fixed an error like this and thought as no one else had found this solution I'd post it. I found that the stdlib had declared NULL as ___need_NULL in my AVR GCC compiler. This caused an error in Eclipse IDE. The error was however caused by Coden Analysis not finding the anomaly and so winging that the symbol could not be found. You can turn Coden off in Preferences under "General -> Startup/Shutdown" or change its behaviour in C/C++ Code analysis.

    This may explain the sometimes random nature others are experiencing

    0 讨论(0)
  • 2020-12-06 04:43

    nothing of the suggestions above helped me. Every time opening a file the exclipse reports dozens of errors.

    What helped in the end: Closing all files, then deleting the bugs manually (right click on the error list in the Problems window), then do a rebuild index.

    0 讨论(0)
  • 2020-12-06 04:44

    I think that you have not added header file that defines NULL . Add stdlib.h (#include statement). it defines NULL macros.

    0 讨论(0)
  • 2020-12-06 04:46

    Just add C:\MinWG\lib to the Eclipse's Library Paths.

    0 讨论(0)
  • 2020-12-06 04:46

    I also encounter a similar problem which is "Symbol elf magic could not be resolved", and the elf header has already been included. I think that the problem may be caused by library cache,for restarting software can solve the problem. Thank for others' help.

    0 讨论(0)
提交回复
热议问题