Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Go to definition - HOW?(I don't understand how go to definition works)
Go to definition - HOW? [message #694252] Fri, 08 July 2011 07:53 Go to next message
markus.johansson is currently offline markus.johanssonFriend
Messages: 2
Registered: July 2011
Junior Member
Hello all.
I'm using Eclipse Helios with CDT 7.0.0 (P2 1.0.0 if that matters).
And i've been searching the web and found many that had problems with this issue but for some years ago, and the answer the most of them seemt to get was that they should press F3 twice to get to the definition. However this doesn't work for me, I don't get anywhere the second time I press F3.

My indexer is on and it indexes all files and doesn't exclude any files (under 8MB at least).

I have a rather large c++ project with classes (it that matters)...

Have I missed something in the configuration or what am I doing wrong?

//BR Markus
Re: Go to definition - HOW? [message #694352 is a reply to message #694252] Fri, 08 July 2011 12:03 Go to previous messageGo to next message
Yevgeny Shifrin is currently offline Yevgeny ShifrinFriend
Messages: 208
Registered: July 2009
Senior Member
Do you have unresolved includes? When eclipse finished full index it shows statistics (in error log). This way you can get a clue what percentage of your code is not resolved.

Thanks,
Yevgeny
Re: Go to definition - HOW? [message #695156 is a reply to message #694352] Mon, 11 July 2011 06:27 Go to previous messageGo to next message
markus.johansson is currently offline markus.johanssonFriend
Messages: 2
Registered: July 2011
Junior Member
I had some unresolved includes that I now have fixed by including them in the eclipse project. However there is still a very strange behavior, that if I'm in the .h file and press F3 on some functions it moves to the .c implementation, but for some other functions it doesn't... And I don't see any difference among those functions who work and those that not work.
Where do I find this error log?
Re: Go to definition - HOW? [message #710041 is a reply to message #695156] Thu, 04 August 2011 16:05 Go to previous messageGo to next message
Valentin  is currently offline Valentin Friend
Messages: 3
Registered: January 2011
Junior Member
markus.johansson:
Error log you can found at View->Other...->Error Log.

I use CDT 8.0.0 and I have the same behavior! Some functions work, and some (in the same .cpp and .h) doesn't.

This is my case:

CWorkTarget.h fragment:
class CWorkTarget
{
...
static CWork* GetPtr(int nWork);

static CWorkTarget* FindWorkByID(WORD wWorkID);
...
};

CWorkTarget.cpp fragment:
CWork* CWorkTarget::GetPtr(int nWork)
{
	if (nWork < 0 || nWork >= count(s_xTrgWork)) return NULL;

	return &s_xTrgWork[nWork];
}

CWorkTarget* CWorkTarget::FindWorkByID(WORD wWorkID)
{
	for (int i = 0; i < count(s_apWork); ++i)
	{
		if (s_apWork[i]->isWaitingCPUReplies(wWorkID)) return s_apWork[i];
	}

	return NULL;
}


Both functions are near each other (just one CRLF between them) CWorkTarget::GetPtr swithes by F3 to definition/declaration successfully, but CWorkTarget::FindWorkByID does not, cursor stands only on declaration.

Re: Go to definition - HOW? [message #710064 is a reply to message #710041] Thu, 04 August 2011 16:38 Go to previous message
Valentin  is currently offline Valentin Friend
Messages: 3
Registered: January 2011
Junior Member
I think, I can answer myself Smile

Problem was in "WORD" definition, that is protected by #ifdef SOME_SYMBOL
Compiler knows this SOME_SYMBOL and compiles successfully, but indexer doesn't, so WORD was unresolved symbol, and whole function implementation was unresolved too.

I've defined SOME_SYMBOL in project settings manually and problem disappeared!
Previous Topic:Project Template Engine -- trying to get help pages example working
Next Topic:Configuring the debugger in Photran: command-line piping
Goto Forum:
  


Current Time: Sat Apr 27 02:08:06 GMT 2024

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

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

Back to the top