Go Down

Topic: error: redefinition of 'void setup() (Read 76515 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