How to get eclipse use the correct Pins_*.h?



  • I have everything for RRF setup in eclipse. It is working. I can compile successfully and get working binaries out of it. There is just one annoying thing that I cannot get to work correctly:

    It only looks at Pins.h for the feature flags like SUPPORT_WORKPLACE_COORDINATES or SUPPORT_LASER and all of the others.

    In my case I use Duet2_RTOS as the active build configuration and to all I can see it should recognize src/DuetNG/Pins_DuetNG.h but it doesn't.
    This leaves me with sometimes hard to navigate code parts where something is enclosed in #ifdef XXX ... #endif and eclipse evaluates XXX to 0 because that's the value in Pins.h but in Pins_DuetNG.h it is redefined to be 1. And it just won't let me navigate code in this case.

    What could I check/do about that?



  • Found it. Although the indexer was enabled in global settings with correct values I had to go to
    Project -> Properties -> C/C++ General -> Indexer
    and tick Enable project specific settings.

    All of the so called project specific settings are absolutely identical to the ones of the global indexer but now it works. 🤦


  • administrators

    It works for me. What version of Eclipse are you using? I use Version: 2018-09 (4.9.0).

    There is a setting in Eclipse to rebuild the index when you switch build configuration, and I have that selected.



  • @dc42 I am using Version: 2018-12 (4.10.0) but it never worked in any version for me. I rebuilt the index about a million times already. Also it shows the src/DuetNG folder as excluded in the Project Explorer even though it obviously includes it when compiling because it builds the binaries without any issues.

    I also tried to add the folder explicitly to
    Project Properties -> C/C++ General -> Preprocessor Include Paths, Macros etc. -> CDT User Setting Entries
    in all of the available forms. It just does not want to read this file.

    Switching build configurations back and forth also did not help. I mean, I can work with it and found my ways around it but it would be nicer not to have to use global search to find things that I cannot jump to because they are inside #ifdef blocks.


  • administrators

    I sometimes find that in order to get the correct folders shown, I have to select another configuration, then go back to the one I want.



  • Found it. Although the indexer was enabled in global settings with correct values I had to go to
    Project -> Properties -> C/C++ General -> Indexer
    and tick Enable project specific settings.

    All of the so called project specific settings are absolutely identical to the ones of the global indexer but now it works. 🤦


Log in to reply