Thomas (boggyb) wrote,

More cross-compiling adventures

Today's discovery is working out just how to configure Eclipse so that it actually finds the correct headers for a C++-based project I was poking at. This is hard enough most of the time but in this case it's cross-compiled with a MinGW-based GCC and a custom Makefile, and Eclipse CDT helpfully doesn't tell you that autodetecting the config failed.

No, this isn't the NAS I was poking at a few years back - that I solved by getting a slightly newer NAS with a more complete Linux install including compiler. Today's target embedded system is a 3DS, using the devkitARM toolchain.

Anyway the answer was surprisingly easy but not at all intuitive: in the project properties go to C++ Build and on the Builder Settings tab tick Generate Makefiles automatically but don't apply the change yet. Then go to C++ Build → Settings and a new Tool Settings tab will be visible. Select Cross Settings and fill in the correct path and prefix (including the trailing hyphen, so something like "arm-none-eabi-"). Finally go back to Builder Settings and untick Generate Makefiles automatically, and now you can apply the changes. Right-click on the project, pick Index → Rebuild and all the broken includes should sort themselves out.

That solved most of my problems but still left Eclipse whining about some unresolved includes. That turned out to be because the code I was looking at wanted a newer C++ standard - to fix that go through the rigmarole to make Tool Settings reappear and under Cross G++ Compiler → Dialect pick the appropriate standard. Or if the one you want isn't listed, then enter the option in Other dialect flags (for devkitARM I needed "-std=c++14").

I still had to manually add the header path for libctru and a couple of defines that were in the Makefile, but that's fair enough - it's getting the system headers all sorted that's the hard part!
Tags: nintendo 3ds, programming

  • Summon giant frog?

    Impa has a rather unusual finishing move in Hyrule Warriors Calamity...

  • King Dorephan = Boss Nass?

    Is it just me, or does King Dorephan from Hyrule Warriors: Calamity remind anyone else of Boss Nass from Star Wars: Episode 1? I was slightly…

  • Link's Awakening: the third nightmare

    So I actually wrote most of this in November last year... but never got round to posting it. Anyway, since people have been asking for more posts -…

  • Post a new comment


    default userpic
    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.