Pages: [1]   Go Down
Author Topic: error: redefinition of 'void setup()  (Read 5985 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 33
Do I know ya, brotha?
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
http://arduino.cc/en/Tutorial/Melody
Logged

Forum Administrator
Cambridge, MA
Offline Offline
Faraday Member
*****
Karma: 12
Posts: 3538
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Keynsham, UK
Offline Offline
Full Member
***
Karma: 0
Posts: 224
I like for loops and walks on the beach,
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

"C++ : Where friends have access to your private members." - Gavin Russell Baker

Montreal
Offline Offline
Full Member
***
Karma: 0
Posts: 185
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I try compiling it and everything was fine?
Patgadget
Montreal
Logged

Patgadget
Montreal

Pages: [1]   Go Up
Jump to: