How to use C++ with ESP-IDF and FreeRTOS please ?
Posted: Mon Jan 16, 2023 2:13 pm
Good afternoon,
I am using Eclipse CDT (ESP-IDF) in order to work with a ESP32-S3-DevKitC-1 EVM.
After creating a new project, I get a main.c main file for my application.
Instead of using a c file, I would like to use C++ in order to work with class.
So I renamed my main file main.cpp and decleared the app_main(void) function extern "C" app_main(void).
When I do this, I manage to execute the app_main function but when I want to use some of the methods provided by ESP-IDF, for example esp_chip_info(...), the compiler does not found some references anymore.
For example :
esp_chip_info_t chip_info; => I get the errors (Type esp_chip_info_t could not be resolved).
esp_chip_info(&chip_info); => I get the error invalid arguments
these two lines are oK when I use a main.c file instead of C++ file.
At the beginning ot my main.cpp file, I put the include files in a extern "C" { ..... }
Do you know how to solve this problem please ?
Best regards,
Thomas TRUILHE
I am using Eclipse CDT (ESP-IDF) in order to work with a ESP32-S3-DevKitC-1 EVM.
After creating a new project, I get a main.c main file for my application.
Instead of using a c file, I would like to use C++ in order to work with class.
So I renamed my main file main.cpp and decleared the app_main(void) function extern "C" app_main(void).
When I do this, I manage to execute the app_main function but when I want to use some of the methods provided by ESP-IDF, for example esp_chip_info(...), the compiler does not found some references anymore.
For example :
esp_chip_info_t chip_info; => I get the errors (Type esp_chip_info_t could not be resolved).
esp_chip_info(&chip_info); => I get the error invalid arguments
these two lines are oK when I use a main.c file instead of C++ file.
At the beginning ot my main.cpp file, I put the include files in a extern "C" { ..... }
Do you know how to solve this problem please ?
Best regards,
Thomas TRUILHE