# CANNOT #include \<iostream\> for External modules

**URL:** <https://discuss.px4.io/t/cannot-include-iostream-for-external-modules/37477>\
**Category:** PX4 Autopilot\
**Created:** [March 26, 2024, 4:23pm UTC](https://discuss.px4.io/t/cannot-include-iostream-for-external-modules/37477 "2024-03-26T16:23:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vahe\_Yepremyan](https://discuss.px4.io/user_avatar/discuss.px4.io/vahe_yepremyan/32/15688_2.png) [@Vahe\_Yepremyan](https://discuss.px4.io/u/Vahe_Yepremyan)\
**Post date:** [March 26, 2024, 4:23pm UTC](https://discuss.px4.io/t/cannot-include-iostream-for-external-modules/37477/1 "2024-03-26T16:23:21Z")

</div>

Hello.  
I’m trying to add my custom module for the PX4 autopilot. Everything is fine if I add it inside the PX4 tree (i.e. next to src/examples/px4\_simple\_app), however I’d like to have it in separate folder and build the autopilot using **EXTERNAL\_MODULES\_LOCATION** flag.

I encounter the following error while building:

> fatal error: iostream: No such file or directory  
> 40 | #include \<iostream\>

I believe that it is built as C++ code, since I can add classes in it. Also it builds successfully for target **px4\_stil** , but not for **px4\_fmu-v3\_default**.

Would be happy for any advice,  
Kind regards,  
Vahe

---

<div class="post-metadata">

**Author:** ![JulianOes](https://discuss.px4.io/user_avatar/discuss.px4.io/julianoes/32/30_2.png) [@JulianOes](https://discuss.px4.io/u/JulianOes)\
**Post date:** [March 27, 2024, 7:13pm UTC](https://discuss.px4.io/t/cannot-include-iostream-for-external-modules/37477/2 "2024-03-27T19:13:16Z")

</div>

The C++ STL is not available within the PX4/NuttX build. To print to console, just use `printf()` or `PX4_INFO()`.

---

<div class="post-metadata">

**Author:** ![Vahe\_Yepremyan](https://discuss.px4.io/user_avatar/discuss.px4.io/vahe_yepremyan/32/15688_2.png) [@Vahe\_Yepremyan](https://discuss.px4.io/u/Vahe_Yepremyan)\
**Post date:** [March 28, 2024, 7:39am UTC](https://discuss.px4.io/t/cannot-include-iostream-for-external-modules/37477/3 "2024-03-28T07:39:07Z")

</div>

Thanks for the reply.  
I wonder why am I able to **make px4\_stil EXTERNAL\_MODULES\_LOCATION=/path/to/ext** in that case ? Also, I can **make px4\_fmu-v3\_default** successfully if I add my C++ module inside the px4 tree. The issue comes only if I **make px4\_fmu-v3\_default EXTERNAL\_MODULES\_LOCATION=/path/to/ext**.  
Am I missing something(maybe in CMakeLists.txt) ?  
I’m using **Px4 Autopilot 1.14** release version.
