Wednesday, November 19, 2014

Getting rid of redlines in eclipse c++ with Makefile project

I created a new eclipse project for c++, using an existing makefile. The project sources built without error when I hit build (it ran the makefile, no errors). But eclipse listed hundreds of errors in its "errors" panel and my code was covered in redlines. None of the standard suggestions worked, such as adding /usr/include to Paths and Symbols. Finally I discovered the Preprocessor Include Paths dialog. Click on the Providers tabby-thing, and select the radio buttons shown below.
The other thing I realized is that if you have  a large code base, the eclipse code indexing simply craps out, usually with an OutOfMemoryException. We have 1500 C++ files in our code base and thousands of headers. The indexer would hang Eclipse every time. Therefore, under Paths And Symbols > Source Location, I select only the current source directory I am working on, vs selecting the entire source root. No more redlines. Yeah.