Switch header/source files

Answered

Pretty much every C++ IDE I have ever used has a very visible and accessible button for switching between class source files and their declaration headers. Is there such a button in CLion and if so, where is it? Personally I would prefer this feature very accessible as its something I use all of the time and would rather not have to click through the project file structure or use my "hack" solution of finding some member function and using it to jump to its class declaration.

0
5 comments

Hi Ford.

Please try to use 'Related symbol' action. ^⌘↑ key combo on OS X and Ctrl + Alt + Home key combo on Windows or Linux.

0
Avatar
Permanently deleted user

That's unfortunately not quite the same. You only want to flip between the two files (header and source) and hopefully retain the same cursor position in both.

For example, if I'm documenting a function in a header and I need to go to the source for reference, I don't want to lose my cursor position in the header when going back, or have to go over a particular function. Also, if I'm doing some cleanup and moving includes from header to source, this does not work, since there's no "symbol" to go to.

I know most other languages have no analogue to this, but it's something that exists in practically every other C++ IDE.

 

 

0

Thank you for the detailed comment! Feel free to comment or upvote an issue about keeping caret position: https://youtrack.jetbrains.com/issue/CPP-6196.

0
Avatar
Permanently deleted user

In CLion 2019.03 hitting F10 switches header and source files without changing carret position. That is the typical behaviour of other IDEs when hitting F4 (default key in QtCreator and probably some other), what I believe @... has asked for.

2

Please sign in to leave a comment.