wokwi / wokwi-features

Wokwi Feature requests & Bug Reports
https://wokwi.com
73 stars 17 forks source link

Error when using IDF cpp (not c) code on esp32 #805

Open AbdelwahedTahri opened 4 months ago

AbdelwahedTahri commented 4 months ago

Describe the bug The bug happens when you use an IDF cpp code with esp32.

if you don't use idf template

if u use idf template

In this case you can't run cpp code (classes, templates, lambdas ...) because the compiling script uses the c compiler. and adding extern "C" generate another error

To Reproduce https://wokwi.com/projects/400791516965254145 https://wokwi.com/projects/350976545001570899

Simply you can't have a definition of app_main() within your source file https://wokwi.com/projects/304209256260829762 this is another example but this time it is yours ad you'll see on load you run it it runs as the bin is already there but if you just add a comment or something and try to recompile it it will fail

Expected behavior what expected is that the program compile and run as it was before without telling me "multiple definitions of app_main"

Environment (please complete the following information):

Additional context Add any other context about the problem here.

OsvaldoTCF commented 1 month ago

So, to have the same behavior as before using C++ files, IDF libraries, etc., try use the ".ino" extension - that is, compile for Arduino - rearrange loop() and setup() with the empty loop() and the setup() with a function that would be the app_main() of an IDF application. Without the bulker configuration for idf: "attrs": { }

Maybe it will help until there is a definitive solution consistent with the previous behavior:

https://wokwi.com/projects/410303509952875521

OsvaldoTCF commented 1 month ago

As expected, functions that require the IDF directly do not work. Or, at least I couldn't make it work. This is the case with the esp_log.h.

The issue is that we need IDF builder mode and C++: "attrs": { "builder": "esp-idf" } and C++ (main.cpp, *.hpp, etc)