12

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.

davejagoda
  • 2,420
  • 1
  • 20
  • 27
abhijit
  • 345
  • 1
  • 3
  • 11
  • Have you sources of `libModule.a`? – fghj Nov 10 '15 at 01:01
  • 1
    Yes. They are on the same file system. – abhijit Nov 10 '15 at 09:06
  • 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 libraries – fghj Nov 10 '15 at 09:10
  • 1
    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. – abhijit Nov 12 '15 at 10:41
  • 1
    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. – phcerdan May 24 '17 at 23:17
  • Looking for the same! Any ideas...? (5 years have passed...) – ch271828n Mar 11 '20 at 13:51

2 Answers2

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.

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).

Vit
  • 793
  • 4
  • 17