Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Issue with cdt Indexer and iterators(CDT fails to index iterators)
Issue with cdt Indexer and iterators [message #1772570] Tue, 12 September 2017 14:34 Go to next message
Graham Clarke is currently offline Graham ClarkeFriend
Messages: 2
Registered: September 2017
Junior Member
I am currently using Eclipse 4.6.3 with CDT 9.2.1.201704050430. Due to restrictions on the build systems eclipse being used strictly as an editor/indexer for development but build related aspects are not set up and do not work.

I have a number of spots in the code where list iterators are used to access list elements. CDT does not seem to be able to properly index these iterators, see the example below. Does anyone have any ideas what I could do to fix it? I have already rebuild the index a number of times that will not fix the problem by itself.

typedef std::list<CUSTOMCLASS*> LIST_NAME;

LIST_NAME::iterator NAME = LIST_NAMEinstance.begin();
(*NAME)->CLASS_METHOD()

in this example eclipse will recognize the list type, the LISTNAME typedef. It will recognize that NAME is an iterator of LISTNAME and NAME. will produce a list of iterator related operators ect but (*NAME)-> will not produce a list of methods, and (*NAME)->CLASSMETHOD() gets flagged as an Method could not be resolved. The code does compile and run correctly this seems to be specifically related to the eclipse project setup or perhaps a CDT bug.
Re: Issue with cdt Indexer and iterators [message #1772604 is a reply to message #1772570] Wed, 13 September 2017 00:59 Go to previous messageGo to next message
David Vavra is currently offline David VavraFriend
Messages: 626
Registered: October 2012
Senior Member
Works for me.
index.php/fa/30717/0/
DId you define CUSTOMCLASS?
If not then CLASS_METHOD isn't really a member.
Here, I've substituted XXX and pXXX.
Note that (*pXXX)->CLASS_METHOD() can't be resolved.
index.php/fa/30718/0/
Neither CDT nor the compiler will be able to resolve it.
If your code compiles and runs then it is different than what you've posted.
If you continue to experience this problem then post a small complete program that illustrates it.

[Updated on: Wed, 13 September 2017 01:15]

Report message to a moderator

Re: Issue with cdt Indexer and iterators [message #1772642 is a reply to message #1772604] Wed, 13 September 2017 13:19 Go to previous message
Graham Clarke is currently offline Graham ClarkeFriend
Messages: 2
Registered: September 2017
Junior Member
Unfortunately I cant post much actual code because the system is on a closed network, but that example you have made above is sufficient. Just as a test I went ahead and implemented it in my copy of eclipse and it does fail for me in the same places. Neither the val in (*LIST_NAMEinstance.begin())->val; nor the CLASS_METHOD in (*NAME)->CLASS_METHOD(); resolve in my eclipse for some reason.
If I add
CUSTOMCLASS *test;
test->CLASS_METHOD();
CLASS_METHOD will resolve for the local variable, so the class is being recognized but for some reason once I start working with the iterators everything seems to stop working for some reason.
Previous Topic:Eclipse CDT Debug attach usage
Next Topic:How does Eclipse "makefile" do "Build project" ?
Goto Forum:
  


Current Time: Mon Dec 11 05:57:14 GMT 2017

Powered by FUDForum. Page generated in 0.01951 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software