3

I know there are a lot of answers, but no one is useful.

Ubuntu 16.04
Eclipse 4.6.2

I have tried every solution including:

  1. Add -std=c++11 or c++14 or c++0x or gnu++0x or gnu++11 in the "Command to get compiler specs".
  2. Add __GXX_EXPERIMENTAL_CXX0X in the "Symbols".
  3. Add __cplusplus and set value to 201402L.

So I just wonder, why can't the developer just design an option to enable it?

Does any one have solution?

Oh am I forgot to rebuild? No.

To provide more information, I use a custom script to build my *.cpp. And I think build options won't affect the recognizance right?

Sorry about missing "11".

Sraw
  • 18,892
  • 11
  • 54
  • 87
  • Did you try this: https://stackoverflow.com/questions/17131744/eclipse-cdt-indexer-does-not-know-c11-containers/24628885#24628885 – Galik Jan 19 '17 at 09:22
  • @Galik Yep, I have tried. And `std=c++11` is just a wrong typing. I will revise it. – Sraw Jan 19 '17 at 09:26
  • If you are using a custom script to build your program then `eclipse` settings are irrelevant. It is your script that needs fixing. – Galik Jan 19 '17 at 11:05
  • What do you mean by enable C++11? Eclipse is a development environment, not a compiler. – ThomasMcLeod Jan 19 '17 at 17:41
  • @ThomasMcLeod Actually, I means how could I make it recognize the symbols like "std::unordered_set" or "std::list" which are contained in c++11. – Sraw Jan 20 '17 at 01:59
  • What do you mean by recognize? If you are talking about the code indexer Codex, then you merely `include` the header file in the source code and the indexer will pick it up. You must tell Eclipse CDT where to find your library headers. – ThomasMcLeod Jan 20 '17 at 02:19
  • @ThomasMcLeod I'm not a new comer so surely I know hot to tell eclipse CDT where to find all I need. And the header files are perfectly included even no errors while compiling. But It just can't recognize the symbols and tell me that is an unresolved one. Now I have switched to NetBeans, how easily it can be to use it. Just change an option. – Sraw Jan 20 '17 at 02:26
  • If you using a makefile or the external build system you must you must tell the compiler and tell eclipse where to find the headers. It is possible that the compiler is finding the headers but eclipse is not. Eclipse has a built-in standard output scraper that will sometimes work and sometimes not. If it's enabled it will read the output from the compile line actually not the output the input into the compiler and register - I Flags for itself. Otherwise you can put in the header file path manually. If this is all set up correctly and you're still not recognizing symbols rebuild the index. – ThomasMcLeod Jan 20 '17 at 02:37
  • @ThomasMcLeod Eclipse CDT could resolve the header files but not the symbols. For example, it can resolve `#include ` but when I use `list`, it still tell me it is an unresolved one. So this is not a problem about header files. I can even dive into the header files through eclipse. – Sraw Jan 20 '17 at 02:44
  • Well the list is not specifically cplusplus 11. What happens when you dive into the header file from eclipse and search on list? Is the Declaration in the header greyed out? Did you manually rebuild the index for the project? – ThomasMcLeod Jan 20 '17 at 02:49
  • @ThomasMcLeod Yep, I rebuild the index manually. I can search the Declaration of `list` in the header file. – Sraw Jan 20 '17 at 02:52

1 Answers1

0

While your question is not very clear to me, I would like to recommend using eclipse-cdt

It comes as a plugin for eclipse. Please use the eclipse update manager to install this plugin and get started with your C++ development work.

Rishi
  • 1,387
  • 10
  • 14