Author Topic: How to find a definition of a symbol?  (Read 3707 times)

Offline sparhawk

  • Multiple posting newcomer
  • *
  • Posts: 26
How to find a definition of a symbol?
« on: January 08, 2014, 07:05:31 pm »
I had some compiler error in my code, where a name was already used in some system include file I was not aware of.
I moved the mouse cursor over the name and Code::blocks gave me that nice little popup where I can see the different definitions. From this I could see that there were indeed two names differently defined, but I had a hard time finding it's location.

Since Code::Blocks already knows this definition, wouldn't it be helpfull that I could click on this and Code:Blocks loads the file into the editor showing me the exact location? Or is this already somehow possible? I would think that it knows the path where to find it, right?

I could imagine that something like this would be usefull. In Eclipse you can do similar by rightcklicking on a name and going to the definition of it.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: How to find a definition of a symbol?
« Reply #1 on: January 08, 2014, 07:10:49 pm »
Right-clicking on the variable and chose "Find declaration of" might work.

Offline sparhawk

  • Multiple posting newcomer
  • *
  • Posts: 26
Re: How to find a definition of a symbol?
« Reply #2 on: January 08, 2014, 07:29:36 pm »
AAAH! Thanks! :D  I was so distracted with the popup that it never occured to me to click on the symbol directly.  :o

I couldn't really believe anyway that such an obvious feature wouldn't be there. Just getting used to Code::Blocks as I switched today from Visual Studio to MingW.

Offline sparhawk

  • Multiple posting newcomer
  • *
  • Posts: 26
Re: How to find a definition of a symbol?
« Reply #3 on: January 11, 2014, 05:37:44 pm »
So I have to come back to this. While right clicking helps in some cases, I have now a similar case where this doesn't help.

I'm compiling wxWidgets and because of an error using "-pedantic", I wanted to find the definition of "IMPLEMENT_APP". When I hover over the name, then it shows me two occureences, where one is the #define. When I try to right click however it doesn't find it. Seems it only looks into project files, because none of the options in the menu "Find  implementation|occurences|etc." finds it.

So is there some way to go to that symbol?