Search code examples
eclipseeclipse-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. 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.

Obviously, I don't want that.

Someone said to add all .*pp files Resource > Resource Filters > Exclude all

While this does result in the .pp files not appearing in the list of places a symbol is defined . . . 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.

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. While this removes *.pp from the search path for where is it defined searches AND does not make it disappear from view . . . this applies to all items with the folder, some of which I might not want to 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?


Solution

  • Yes, that's possible:

    1. Make sure, *.pp is not added/registered in Window > Preferences: C/C++ > File Types
    2. Right-click a *.pp file and choose Open With > Other...
    3. In the Editor Selection dialog select the C/C++ Editor, check the checkbox Use it for all '*.pp' files and click OK.