Go Down

Topic: error: redefinition of 'void setup() (Read 12097 times) previous topic - next topic


Whenever I try to use any of the sample code I find in the playground, I get an error when I try to compile the code.  Here it is:

In function 'void setup()':
error: redefinition of 'void setup()' In function 'void loop()':

What am I doing wrong?

I am currently trying to use the code for a piezo player from this link:


Do you have two tabs in your sketch?  When you drag things into the environment, it adds it to the current sketch when you may want to simply open it.


This can be common. An assumption is that tabs are for new sketches. But they only open another file for some more code; for the same sketch. Meaning you only declare void setup() and void loop() once.

So you may have declared this more than once leading to this error.
"C++ : Where friends have access to your private members." - Gavin Russell Baker


I try compiling it and everything was fine?

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131