3

My Eclipse CDT indexer apparently cannot find std::unordered_map, although the compiler does. It shows the following "errors":

enter image description here

The "Includes" folder of my project looks like this:

enter image description here

How can I tell the indexer how to find std::unordered_map?

clstaudt
  • 21,436
  • 45
  • 156
  • 239
  • You must activate support for C++11. See http://www.eclipse.org/forums/index.php/mv/msg/282618/787571/ for more. – Olaf Dietsche Dec 07 '12 at 15:56
  • The solution described there does not help. – clstaudt Dec 07 '12 at 16:21
  • 2
    Your include paths mention gcc 4.2 that is pretty obsolete (regarding C++11 support). Since you use auto keyword, I assume your gcc version to be at least 4.4 (gcc's C++11 support table tells that auto was added in 4.4). So try to change include path according to the most recent gcc's include directory. – Artem Sobolev Dec 07 '12 at 17:53

3 Answers3

1

For a solution to the indexer-C++11-problem in general, see the answer to this question: Eclipse CDT indexer does not know C++11 containers

Community
  • 1
  • 1
clstaudt
  • 21,436
  • 45
  • 156
  • 239
0

unordered_map is under tr1 namespace of std.

So you have to add this inclusion:

#include <tr1/unordered_map>

and then you can declare your variable in main in this way:

std::tr1::unordered_map<int,int> mapArray[10];
Luca Davanzo
  • 21,000
  • 15
  • 120
  • 146
0

I am using Eclipse Juno CDT and gcc4.7 on Ubuntu 12.10 and have std=c++11 defined. Still indexer was going nuts about unordered_map. Adding TR1 resolved the issue.