Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Call Hierarchy doesn't work as I would expect
Call Hierarchy doesn't work as I would expect [message #658532] Tue, 08 March 2011 20:52 Go to next message
Tim Westbrook is currently offline Tim WestbrookFriend
Messages: 8
Registered: March 2011
Junior Member
given test.cpp and test.h below
//test.h
#ifndef TEST_H_
#define TEST_H_

class test
{
   public:
      test();
      virtual
      ~test();
      void callme(void);
      void call_callme(void);
};

#endif /* TEST_H_ */




// test.cpp
#include "test.h"
test::test()
{
}

test::~test()
{
}

test::callme(void)
{
   // noop
}

test::call_callme()
{
  callme(void);
}


If from the test.cpp editor I highlight callme in the test::callme definition and CTRL-ALT-H I get

Cannot resolve selected text to a defined function or member

(similarly if I highlight test::callme)

If I select the actual call to callme() in call_callme definition and then CTRL-ALT-H I get a reference to the declaration in the header file. I would expect that the call hierarchy should find the call in call_callme().

I would expect that the call in test::call_callme() would show up in the call hierarchy

Funny thing is some call hierarchy stuff seems to work, basically I was seeing a problem in one of my source files and I was trying to find the core problem.

I have tried creating a file more redirects and whenever i select a call, i only get a reference to the declaration.

Am I doing something wrong ?

I am using a released helios cdt if it matters, although I saw the same problem on a version of galileo.

Any insight would be appreciated.

Thanks
Re: Call Hierarchy doesn't work as I would expect [message #660352 is a reply to message #658532] Fri, 18 March 2011 04:50 Go to previous messageGo to next message
Marc-Andre Laperle is currently offline Marc-Andre LaperleFriend
Messages: 171
Registered: July 2009
Senior Member
I don't think that code would compile Razz

Try this instead:

// test.cpp

...

void test::callme(void)
{
// noop
}

void test::call_callme()
{
callme();
}
Re: Call Hierarchy doesn't work as I would expect [message #663637 is a reply to message #660352] Wed, 06 April 2011 00:50 Go to previous messageGo to next message
Tim Westbrook is currently offline Tim WestbrookFriend
Messages: 8
Registered: March 2011
Junior Member
Doh! (headsmack)

Sorry, the code I'm working on is not actually being compiled on the system I am editing it on. So I didn't actually try to compile the example code.

I'm guessing cdt is not able to determine the function call path due to some ambiguity. But I haven't had time to try to reproduce.

Thanks for your help

I will repost If I can drill down to the problem I am seeing in my production code.

Cheers,
Tim
Re: Call Hierarchy doesn't work as I would expect [message #663638 is a reply to message #663637] Wed, 06 April 2011 00:59 Go to previous messageGo to next message
Marc-Andre Laperle is currently offline Marc-Andre LaperleFriend
Messages: 171
Registered: July 2009
Senior Member
If you're using CDT < 8.0 you could turn on the problems semantic highlighting. It will detect some problems as you type without the need of compiling. With 8.0 it will actually give you errors with descriptions, not just change the text color to red.

To turn on problems semantic highlighting : Preferences > C/C++ > Editor > Syntax coloring > Problems, Check Enable.

In CDT 8.0, the errors work out of the box.

In both cases, you will need the paths and symbols properly setup (Project properties, C/C++ General, Paths and Symbols) or else you will have a lot of false errors.
Re: Call Hierarchy doesn't work as I would expect [message #811669 is a reply to message #658532] Fri, 02 March 2012 17:12 Go to previous message
Max MacLean is currently offline Max MacLeanFriend
Messages: 1
Registered: March 2012
Junior Member
Hello,

I also struggled with the problem of the Open Call Hierarchy (and the Open Declaration) dialogs not finding the function or variable I had highlighted.
I found that by creating a new workspace and importing my project into it, these functions started to work as expected. Now I realize that this does not solve or shed too much light on the root cause, but it is a quick work around.

Max
Previous Topic:Disable annotations in editor: possible?
Next Topic:Link .lib in Eclipse CDT for Windows, Cygwin G++ linker
Goto Forum:
  


Current Time: Sun Nov 23 03:43:38 GMT 2014

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

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