wokwi-features icon indicating copy to clipboard operation
wokwi-features copied to clipboard

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

Open AbdelwahedTahri opened this issue 1 year ago • 2 comments
trafficstars

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

if you don't use idf template

  • Before i was able to run a code containing class declaration and definition and a main_app() content without any problem and now i get this message -> "multiple definitions of app_main"
  • i can understand that the reason is that the main_app() is declared also on main.cpp within arduino core library
  • but i'm saying that before it was working, idk why but it was

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):

  • Browser : firefox
  • Version idk

Additional context Add any other context about the problem here.

AbdelwahedTahri avatar Jun 15 '24 20:06 AbdelwahedTahri