How to navigate to source code in linked libraries in Clion?
Asked Answered
G

2

15

I have a project that links multiple static libs (e.g. libModule.a). When I try to navigate to classes inside the Module lib, Clion takes me only to the header declaration and stops navigation there. I want to be able to dig into the definition of functions inside the Module lib.

Gratis answered 10/11, 2015 at 0:36 Comment(6)
Have you sources of libModule.a?Clippard
Yes. They are on the same file system.Gratis
Then have you CMakeLists.txt that describe you project and these libraries (how build them), without this clion have no idea about where get sources of librariesClippard
I have libraries that have been already build and also have their source code. In Netbeans, if I have a debug built application, by configuring "Code Assistance" to take binary as source I can easily navigate to all calls in library as well.Gratis
Did you find a way? Or any workaround? Looking for the same. I remember in eclipse I used to build the library, and export that library project to Eclipse, then I could link that external project to my application.Mimas
Looking for the same! Any ideas...? (5 years have passed...)Joannajoanne
L
1

I had the same problem and here is what I did. In Clion I enabled debug logging by entering #com.jetbrains.cidr.execution.debugger into Help | Debug Log Settings, reproduced the problem and then looked at the idea.log created (Help | Show Log). In the log it showed the full path to the source it could not find. The source on my box was not in the same place, so by creating a symbolic link in the appropriate directory I was able to have Clion find it by the full path it was looking for.

Lamonica answered 27/3, 2018 at 19:22 Comment(0)
D
0

For CMake projects just add path to your lib source code in CMakeLists.txt via:

include_directories(${SOME_LIB_SRC_DIRS})

or direct path

include_directories("/home/username/lib_src/")

Then on function name ctrl+click CLion will show you function definition first and then if you ctrl+click again -- will show you declaration in a header file (also you can use hotkeys and mouse right-click menu for this).

Damnation answered 14/7, 2020 at 9:52 Comment(1)
I have tried this, it will include source code in compiling.Ruelas

© 2022 - 2024 — McMap. All rights reserved.