how to use some libraries based on cpp?
how to use some libraries based on cpp?
Hi, I am trying to use cpp based codes, but the build result returns some syntax errors. Is it possible to use cpp syntax with IDF?
Re: how to use some libraries based on cpp?
It is possible. There is even a small amount of C++ code inside the IDF internals themselves.
Neil Kolban has some C++ samples/snippets/utils here: https://github.com/nkolban/esp32-snippe ... /cpp_utils
STL is available. But there are some restrictions, for example exception support is disabled.
Can you please be more specific about the errors you are seeing?
Neil Kolban has some C++ samples/snippets/utils here: https://github.com/nkolban/esp32-snippe ... /cpp_utils
STL is available. But there are some restrictions, for example exception support is disabled.
Can you please be more specific about the errors you are seeing?
Re: how to use some libraries based on cpp?
There are also a couple of sample skeletons for C++ available here ...
https://github.com/nkolban/esp32-snippe ... letons/cpp
https://github.com/nkolban/esp32-snippe ... letons/cpp
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32
Re: how to use some libraries based on cpp?
Thank you for the kind replies, ESP_Angus and N. Kolban.
I am using basic idf and I have built my project, after just including some .cpp files in other .c files.
Am I doing wrong?? If it needs other procedures or configurations, could you please let me know?
I am using basic idf and I have built my project, after just including some .cpp files in other .c files.
Am I doing wrong?? If it needs other procedures or configurations, could you please let me know?
Re: how to use some libraries based on cpp?
Can you post some of your code or the exact errors? It's hard to guess from just a rough description like this.ryuhhh wrote: I am using basic idf and I have built my project, after just including some .cpp files in other .c files.
Make sure any C++ symbols (functions, etc.) called from C are marked with 'extern "C"' in their C++ declarations.
Angus
EDIT: Also files in C++ syntax must be in a .cpp file, so the build system knows to run a C++ compiler not a C compiler.
-
- Posts: 1
- Joined: Sun Sep 02, 2018 11:50 am
Re: how to use some libraries based on cpp?
Crash cpp_utils/FreeRTOSTimer.cpp
line timersMap.insert(std::make_pair(timerHandle, this));
Who faced this?
line timersMap.insert(std::make_pair(timerHandle, this));
Who faced this?
Who is online
Users browsing this forum: Google [Bot] and 276 guests