6

On Eclipse CDT, does someone know how to have the external libraries attached by their source codes?

What I want to do is to click the element (e.g. function, variable) names so that Eclipse opens the corresponding part of its source file (or open header file initially, then open source with another click in header). It's possible in Eclipse' Java mode.

Thanks.

IsaacS
  • 3,551
  • 6
  • 39
  • 61

2 Answers2

9

Create a library project. Add external library into it. Open library project Properties, link sources folders via C/C++ General/Paths and Symbols/Source location. Open main project Properties and add library project to Project References.

If you did everything right, Open Declaration action (F3) will open a function sources.

Cheers, Max

Max
  • 2,917
  • 1
  • 16
  • 16
  • Thanks @Max. I've tried but not worked out yet. By "add external library", do you mean copying them into the project folder, or just designating at Build->Settings->C++ Linker ? And also, do you have to compile on Eclipse? – IsaacS Jul 22 '11 at 17:55
  • I mean to copy or link (New File, Advanced/Link) into the project. What is the last question about? – Max Jul 22 '11 at 18:30
  • Sorry, that was not clear. I was asking if compiling the library project was necessary. And now I'm seeing that building the main project requires building the lib prj too, which makes me think I'm still doing something wrong because copied library files have no use if build is necessary. – IsaacS Jul 22 '11 at 21:34
  • Great! It's exactly what I need. – Amos Apr 17 '14 at 13:43
1

In the project explorer you can

  1. right click on the folder name
  2. click on rescource configurations
  3. select exclude from build
Musa
  • 96,336
  • 17
  • 118
  • 137
Arya
  • 145
  • 6