Thomas (boggyb) wrote,
Thomas
boggyb

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
Subscribe

  • Arduino thermometer

    What with the glorious sunny weather, I wondered how hot my flat actually gets. It's certainly felt far too warm recently. Now, the sensible way to…

  • Submanifolds of a Hilbert Space

    If you do software development then you've probably had the misfortune of working with Git as a source control system. Now, those of you who use Git…

  • Caution: may contain flammable bobcat

    On the plus side, today some more shininess arrived at work in a suitably ominous-looking box: Caution: may contain flammable bobcat. This…

  • Post a new comment

    Error

    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.
  • 0 comments