简体   繁体   English

eclipse cdt-如何“从构建中排除资源”特定后缀

[英]eclipse cdt - how to “exclude resource from build” a specific suffix

In my build artifact folder(s), I generate pre-processed output of each .c file *.pp . 在我的构建工件文件夹中,我生成每个.c文件*.pp预处理输出。 Once a build is done, if I go to my .c file(s) and hit F3 (Open Declaration) on a typedef , the popup contains the original .h or .c file and all the *.pp files that included the .h . 构建完成后,如果我进入.c文件并在typedef上单击F3 (Open Declaration) ,则弹出窗口将包含原始.h.c文件以及所有包含.h *.pp文件.h

Obviously, I don't want that. 显然,我不想要那样。

Someone said to add all .*pp files Resource > Resource Filters > Exclude all 有人说要添加所有.*pp文件Resource > Resource Filters > Exclude all

While this does result in the .pp files not appearing in the list of places a symbol is defined . 虽然这确实会导致.pp文件没有出现在位置列表中,但已定义符号。 . . it also has the side-effect of removing the .pp files from view completely so that I can't see or open them at all. 它还具有从视图中完全删除.pp文件的副作用,因此我完全看不到或打开它们。

Of course another way to accomplish this is to Exclude From Build the build output folder: Right click > Properties > C/C++ > Exclude Resource from build . 当然,完成此操作的另一种方法是Exclude From Build构建输出文件夹: Right click > Properties > C/C++ > Exclude Resource from build While this removes *.pp from the search path for where is it defined searches AND does not make it disappear from view . 虽然这会将*.pp从搜索路径中删除,但它在何处定义了搜索,并且不会使其从视图中消失。 . . this applies to all items with the folder, some of which I might not want to Exclude From Build . 这适用于该文件夹中的所有项目,其中有些我可能不想Exclude From Build

QUESTION

Is it possible to Exclude From Build based on a suffix instead of a folder while at the same time having syntax highlighting ON for a given suffix? 是否可以基于后缀而不是文件夹Exclude From Build ,同时将给定后缀的语法突出显示为ON

Yes, that's possible: 是的,这是可能的:

  1. Make sure, *.pp is not added/registered in Window > Preferences: C/C++ > File Types 确保 窗口>首选项:C / C ++>文件类型中添加/注册*.pp
  2. Right-click a *.pp file and choose Open With > Other... 右键单击*.pp文件,然后选择“ 打开方式”>“其他...”。
  3. In the Editor Selection dialog select the C/C++ Editor , check the checkbox Use it for all '*.pp' files and click OK . 在“ 编辑器选择”对话框中,选择“ C / C ++编辑器” ,选中“ 将其用于所有'* .pp'文件”复选框,然后单击“ 确定”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM