问题
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:
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:
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:
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
回答1:
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:
rightClickOnProject->New->Folder
,- Click on
Advanced
button in theNew Folder
dialog box, - select
Link to alternate location
option box, - Browse to your the root directory containing all your headers, and
- Hit the
Finish
button.
Cheers
回答2:
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.
来源:https://stackoverflow.com/questions/17900370/eclipse-kepler-cdt-include-external-header-files-add-external-include-path-rec