Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse Kepler CDT include external header files / Add External Include Path recursively ( with subfolders )

Hi I have a embedded C project and all the basic C libraries are stored in an external folder ( not in the workspace ). I can compile because the compiler knows where to look for this files, but Eclipse does not know that these files exist and I get error messages: enter image description here

I can manually add one folder with: rightClickOnProject->Properties->C/C++ Include Paths and Symbols -> Add External Include Path

For example the file <stdint.h> is located in the folder C:\embARM7\yagarto\arm-elf\include so I do the following:

enter image description here

This solves the eclipse error marker for <stdint.h>

But the file <stdio.h> is located in the folder C:\embARM7\yagarto\arm-elf\include\sys and I have to make the whole process again for:

enter image description here

Now the next header file is located in C:\embARM7\yagarto\arm-elf\include\machine and so on and so forth....

My Question is : Is there a way to add an external include path with ALL subfolders ? Kind of "add this folder and all subfolders" / "add this folder recursively". Like C:\embARM7\yagarto\arm-elf\include\* so that I do not have to add every folder in the folder structure manually. For one project this is 5 minutes but I have to do it for 10 projects and this work kind of sucks.

Thanks

like image 964
Viktor Carlson Avatar asked Jul 27 '13 17:07

Viktor Carlson


2 Answers

I also came across the same issue while to add set of external headers into my project. Instead of using include Paths and Symbols in the Project Properties, I added to my project a link to the root directory which contains all the external headers within its sub-directory. This is how to do it:

  1. rightClickOnProject->New->Folder,
  2. Click on Advanced button in the New Folder dialog box,
  3. select Link to alternate location option box,
  4. Browse to your the root directory containing all your headers, and
  5. Hit the Finishbutton.

Cheers

like image 62
simon_ethio Avatar answered Sep 18 '22 17:09

simon_ethio


I haven't found such option neither in Eclipse 3.7-4.3 nor in MS VS2012. Apparently the workaround is to write a script in any language which would generate the recursive path for you.

For Eclipse, you can write an .xml file with project settings and then import it (Project properties -> C/C++ General -> Paths and Symbols -> Import Settings...). To make an idea of the structure of this file, start by exporting your current project settings somewhere.

like image 20
qwerty Avatar answered Sep 20 '22 17:09

qwerty