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

耗尽温柔 提交于 2019-12-23 09:27:42

问题


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:

  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




回答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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!