Re: CPP support


Kim Boendergaard <kim.boendergaard@...>
 

I think you are missing CONFIG_LIB_CPLUSPLUS=y

When it comes to threads (and semaphores, mutex etc) the Zephyr implementation is lacking a bit, but except from that it is working fine.
We have made our own C++ versions of semaphores, mutex etc based on the Zephyr kernel API.

Usage of iostream takes up a lot of flash resources

Best regards,

Kim Bøndergaard

-----Original Message-----
From: users@... <users@...> On Behalf Of Guy Morand
Sent: Tuesday, 14 December 2021 17.22
To: Zephyr-users@...
Subject: [Zephyr-users] CPP support

EXTERNAL — Use caution when opening link(s) or attachment(s) ________________________________

Hi Zephyr users!

I'm new to Zephyr and was asked to write a small "study" project in c++.
I didn't find much in the documentation about c++, except one sample and the following page:
https://urldefense.com/v3/__https://docs.zephyrproject.org/latest/reference/kernel/other/cxx_support.html__;!!KHGsRxShrw!q__J4PjhnarC-Jb1FvV4Wwd6ge_OL5p7ZPC38_w0Agi5c7hMfT_zp-SLVDmfr3bDSstITFXG$


I'm using the Zephyr SDK 0.13.2 and I started with:

```
#include <memory>

void main(void) {
std::unique_ptr<int> intValue = std::make_unique<int>(1234);

while(1) {
;
}
}
```

My prj.conf contains:

```
CONFIG_CPLUSPLUS=y
CONFIG_STD_CPP20=y
```

Unfortunately, it doesn't build although I can find the <memory> header file in the SDK:

```
main.cpp:6:10: fatal error: memory: No such file or directory
6 | #include <memory>
| ^~~~~~~~
```

* Am I missing something?
* Is the current cpp status is very limited and should avoid standard
library? (what would makes sense :D)

Kind regards,

Guy







[The information contained in this email (including any attachments) is confidential and is intended solely for the use of the named addressee. Any unauthorized use, disclosure, reproduction, copying, distribution, or other form of unauthorized dissemination of the contents is expressly prohibited. If you have received this communication in error, please notify the sender immediately by email and delete the original message. Opinions, conclusions and other information in this message represent the opinion of the sender and do not necessarily represent or reflect the views and opinions of Esco Lifesciences Group companies.]

Join users@lists.zephyrproject.org to automatically receive all group messages.