2

I had a problem when using Eclipse CDT with detecting stl information. I got in-editor errors like "symbol vector could not be resolved". I have solved this using the solution described here:

https://stackoverflow.com/a/13524483/613173

However, it seems that stl::map still has problems. For example, the line

std::map<int,int> a;

Gets the "invalid template arguments" error. Also,

a.begin();

Gives "method 'begin' could not be resolved" error.

However, with default parameters given explicitly:

std::map<int, int, std::less<int>, std::allocator<std::pair<const int, int> > > b;

I got none of those errors. This does not happen with other classes such as std::vector whose template also has more than one argument but I get no complaints over

std::vector<int> a;

Another problem regards iterators. Even if the map was defined with all parameters given explicitly, the "first" and "second" fields give an error:

std::map<int, int, std::less<int>, std::allocator<std::pair<const int, int> > >::iterator i_b = b.begin();
i_b->first;

This gives "Field 'first' could not be resolved".

Compilation works without problems, obviously, but I still want to be able to use Eclipse's static error detection and auto completion.

Eclipse 4.4.2, CDT 8.6.

Community
  • 1
  • 1
Gadi A
  • 3,449
  • 8
  • 36
  • 54

0 Answers0