# Call C++ function from QML

**URL:** <https://discuss.px4.io/t/call-c-function-from-qml/26556>\
**Category:** Uncategorized\
**Created:** [March 13, 2022, 3:30pm UTC](https://discuss.px4.io/t/call-c-function-from-qml/26556 "2022-03-13T15:30:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Duygu\_Tahtaci](https://discuss.px4.io/user_avatar/discuss.px4.io/duygu_tahtaci/32/8603_2.png) [@Duygu\_Tahtaci](https://discuss.px4.io/u/Duygu_Tahtaci)\
**Post date:** [March 13, 2022, 3:30pm UTC](https://discuss.px4.io/t/call-c-function-from-qml/26556/1 "2022-03-13T15:30:09Z")

</div>

Hello everyone,

I want to add a new MAVlink message value for QGC to the interface. So I have to use the return value of the C++ function in the QML file, but when I do it as follows, I get an error and cannot read the value. Anyone know the solution?

![Vehiclecc](https://discuss.px4.io/uploads/default/original/2X/0/0ed21c9c8aa6cd3e7c178fd5fd7143fcf2358d7b.png)  
 ![Vehicleh](https://discuss.px4.io/uploads/default/original/2X/e/ecaf402b8af07ed04d259d405e8fa9ee47cad85e.png)  
 ![Vehicleqml](https://discuss.px4.io/uploads/default/original/2X/3/3e2e85206609e7e4cc423f3263a539811c0e75dc.png)

---

<div class="post-metadata">

**Author:** ![pablojr](https://discuss.px4.io/letter_avatar_proxy/v4/letter/p/7bcc69/32.png) [@pablojr](https://discuss.px4.io/u/pablojr)\
**Post date:** [March 16, 2022, 2:22pm UTC](https://discuss.px4.io/t/call-c-function-from-qml/26556/2 "2022-03-16T14:22:10Z")

</div>

> [@Duygu\_Tahtaci](#):
>
> I get an error and cannot read the value

Which one?

In addition, from your source code snippet it’s not clear what “message” is and where it come from…
