Eclipse / ardupilot compilation failure (compat.h not found)

Hi There,
New to ardupilot/ArduCopter code. Looking to compile/build for Pixhawk (PX4) using the Eclipse IDE. I have following the instructions on the following page: … h-eclipse/

Making sure to first perform the steps given at the following wiki:

Downloaded from Git the ardopilot, PX4Firmware & PX4NuttX and using the PX4 Console was seemingly able to create the and “make px4” successfully. By successfully I mean that the ArduCopter-v2.px4 was created at the end of the make session.

So then going back to the first wiki page listed above I followed the instructions to attempt to build in Eclipse. Finally, when attempting to compile I see the following error:

make[3]: Entering directory /c/Git/PX4Firmware/Build/' CXX: /c/Git/ardupilot/Build.ArduCopter/ArduCopter.cpp [b][color=#FF0000]/c/Git/ardupilot/ArduCopter/ArduCopter.pde:148:20: fatal error: compat.h: No such file or directory[/color][/b] make[3]: Leaving directory/c/Git/PX4Firmware/Build/’
compilation terminated.

I did a search to see if this was a known prob and there appeared to be some hint of it on the following posts, but I am not seeing if that was resolved:!topic … tWVDm3bEGs

Seems somehow the include dir is not being picked up here, even though I added the ArduCopter dir into the include list in Eclipse (where compat.h is found).



I think I have figured out the problem and am posting this to help those out in a similar situ and to perhaps get a more expert based solution.

Essentially the problem appears related the Eclipse IDE not utilising project settings added through the IDE controls itself (like the addition of include dirs). At least that is what appears to be hapenning. I am not sure if I am missing some other setting in the IDE to make that happen, but I wasn’t able to find one.

In this case Eclipse will utilise external makefiles in order to compile the ardupilot/ArduCopter project and those external makefiles do not, by default, contain the include references to the ArduCopter dir. Thus during compilation we fail to find all header files outside of the system ones, even though the ArduCopter include file shows up in the Eclipse Project explorer->Includes section once entered through the project settings.

So in this case I alterred (*hacked) the main makefile under the PX4Firmware\makefiles\ dir to add the following:

[i]export BUILD_DIR = $(abspath $(PX4_BASE)/Build)/
export ARCHIVE_DIR = $(abspath $(PX4_BASE)/Archives)/
[color=#FF0000]export ARDUCOPTER_INCLUDE_DIR = C:/GitHub/ardupilot/ArduCopter[/color]#

Default include paths

[color=#FF0000] $(ARDUCOPTER_INCLUDE_DIR)[/color][/i]

No doubt an expert for the make files can provide a more correct way of solving this, but for now I am unblocked in getting the Eclipse to compile the ArduCopter project from within the IDE.