Failed to build some cpp code for NuttX

I am currently working on PX4 vtol module. I need to make some modifications to the tiltrotor logic and I decided I am going to make these changes to the tiltrotor.cpp file in the latest release: am able to successfully add C++ code and compile for SITL. However I realized when I build the code for NuttX, anything that is Cpp-specific fails to compile ( e.g. #include or #include )

  1. I was wondering if anyone has faced the same issue.
  2. In general, what would be the best practice to make modifications to any module?