Sudden compile errors on a sketch

Hello,

I would like to ask you for your support.
While I was working on a sketch in PlatformIO for Arduino nanoEsp32, suddenly it trowed several error messages out. A moment ago it was compiling w/o any errors and now it’s listing a bunch of it.
I didn’t made knowingly any changes to the code.
It seems to me suddenly its running into these errors.
Perhaps someone can shed some light on this problem.
I tried already to drill down to a possibly culprit in the code but can’t locate anything/ (perhaps my lack of experience with PlatformIO/cpp).
Thanks for any help

I would have uploaded the error messages to this post if I only could have figured out how to attach a file to the post

Since only images are allowed to upload, here is a screenshot:

You have multiple definitions of

  • loop()
  • setup()
  • hoursToString()
  • password
  • ssid

In C/C++ there can only be one definition for a function(*) or a variable, but not multiple! This also includes multiple definitions in different .cpp files!

For example:

You cannot have a setup() function in main.cpp and NTPDateTime.main.cpp!

(*) except for function over

You can use pre-formatted text and paste your error-messages and code fragements.

Oh my gosh.
Thank you for your hint. :slight_smile:

I think my mistake is that I copied a couple of other *.cpp’s into thesrc folder of the project.
I didn’t expect the compiler would compile all source files in the src folder, even though there are no references to these additional files in main.cpp.
I guess I have to take this as another lesson.
I'm used to use link files for compile instructions to the compiler.
I used the copied files as templates for new code in main.cpp).

But here we go. the mystery is resolved thanks to you.

I renamed the ‘templates’ files and now Its compiling fine.

Thank you sivar2311

1 Like