[SOLVED] How to jump from function declaration to function definition.
-
wrote on 30 Jun 2011, 01:11 last edited by
Hello,
I am on Ubuntu / GCC.
If I step on a function declaration in header file how can I jump to this function definition in cpp file? (F2 does not work in this case).
THX!
-
wrote on 30 Jun 2011, 01:28 last edited by
What version are you running? For reference to this I opened up Qt Creator 2.2.1 and opened the Network> Broadcast Receiver demo and F2 worked as expected on the Receiver() function in the header file receiver.h
-
wrote on 30 Jun 2011, 01:41 last edited by
It does work. Sorry. It's getting late here in the US.
-
wrote on 30 Jun 2011, 01:47 last edited by
Glad to help.
-
wrote on 30 Jun 2011, 01:52 last edited by
On the same note, I am including a header file #include "quickfix/SocketInitiator.h"
and linking a library libquickfix.so that contains classes declared in SocketInitiator.h.
Also, I have all the source code for the library including SocketInitiator.cpp.
How would I be able to step into SocketInitiator.cpp while debugging?
Thanks!
-
wrote on 30 Jun 2011, 06:08 last edited by
I'll attach to this question.
Has anyone managed to use F2 / Shift-F2 to jump into Qt sources (headers work fine as expected)?
-
wrote on 30 Jun 2011, 06:28 last edited by
Just jump into the header and then hit F4 to go to the cpp file. Once it is loaded it is available via F2 as well.
The reasoning is that we only want to parse the code that is used in your project: That is your sources and the headers those use. Parsing random .cpp files that happen to be located next to the headers you use will only slow down the parsing as well as the completion itself and does blow up memory usage, too.
-
wrote on 30 Jun 2011, 08:07 last edited by
[quote author="Tobias Hunger" date="1309415289"]Parsing random .cpp files that happen to be located next to the headers you use will only slow down the parsing as well as the completion itself and does blow up memory usage, too.[/quote]
Sounds reasonable.
But what do people use then to dive into the Qt sources? I find it really cumbersome to comb through most of the sources just to find the implementation of a specific Qt function.
Is it possible to instruct QtCreator to index a specific directory which is not in the project?
I think I generally would like the idea of having "static indices", which can be generated at build time and then serve as an index to QtCreator.
-
wrote on 30 Jun 2011, 10:02 last edited by
I just do the F2/F4 combo most of the time.
If I really care about Qt stuff, then I just open Qt as a project:-)
-
wrote on 30 Jun 2011, 14:24 last edited by
I do not quite understand the purpose of F4. I think F2 would be enough if it could load a file and jump into function (and etc.) definition as F4 does. Once header and cpp are loaded F2, F4, and Shift-F2 have the same functionality - sort of excessive.
-
wrote on 30 Jun 2011, 20:14 last edited by
I usually use F4, but I also ctrl+click on the method to jump form definition to source and back.
-
wrote on 10 Jul 2011, 18:11 last edited by
F4 does not work if the file you want to jump to is not already open.