Search code examples
c++11eclipse-cdtautotools

Eclipse NEON CDT doesn't recognize c++11/14 header content


Eclipse NEON.1 4.6.1 with CDT 9.1.0, g++ 5.4.0

It doesn't recognize all c++11/14 features. It does recognize keywords like auto and nullptr. It doesn't however recognize things coming from headers which depend on the correct symbols being defined.

For instance when including <memory> it recognizes old symbols like std::auto_ptr not knew ones like std::shared_ptr. These newer features are within an #if __cplusplus >= 201103L.

I can get it to work for a standard eclipse project by setting the dialect option but I need it to work with an autotools based project which doesn't have a dialect setting.

I have the actual compilation of the program working using AM_CXXFLAGS automake variable. To get it to work for the indexer I went in eclipse to Project properties > C/C++ General > Preprocessor Include Paths, Macros

Then to the providers tab and added -std=c++14 option to the command for the CDT GCC Built-in Compiler settings. I also moved that provider to the top of the list. On the entries tab you can see the actual value of the __cplusplus define. Before I added the -std=c++14 switch it was wel below the required 201103L after I added the switch it was well above.


Solution

  • Found out what the problem was. When I added the -std=c++14 option in the command to get the compiler spec on the provider tab I added them for the "Debug" configuration as I was using that configuration. Turned out that the indexer was set to always use the "Build" configuration. After I added the setting also for the "Build" configuration and reindexed the errors went away.