Go Down

Topic: Error in running Tone tutorial (Read 3 times) previous topic - next topic

Agusta

i tried running the tutorial posted here(http://arduino.cc/en/Tutorial/tone)
but i have been getting the following errors after compilation-->

core.a(main.cpp.o): In function `main':
undefined reference to `setup'

undefined reference to `loop'

can i get help ?

dxw00d


Agusta

uhh, im using the arduino IDE  :smiley-roll:

dxw00d

#3
Mar 24, 2012, 02:30 pm Last Edit: Mar 24, 2012, 02:43 pm by dxw00d Reason: 1
Just checking. Can you post the code you are trying to compile. The code listed on the tutorial page compiles fine.

Agusta

#4
Mar 24, 2012, 03:06 pm Last Edit: Mar 30, 2012, 09:56 am by Coding Badly Reason: 1
this is the code:
Code: [Select]
#define NOTE_G3  196
#define NOTE_B3  247
#define NOTE_A3  220
#define NOTE_C4  262
int melody[] = {
 NOTE_C4, NOTE_G3,NOTE_G3, NOTE_A3, NOTE_G3,0, NOTE_B3, NOTE_C4};

int noteDurations[] = {
 4, 8, 8, 4,4,4,4,4 };

void setup() {
 for (int thisNote = 0; thisNote < 8; thisNote++) {
   int noteDuration = 1000/noteDurations[thisNote];
   tone(8, melody[thisNote],noteDuration);
   int pauseBetweenNotes = noteDuration * 1.30;
   delay(pauseBetweenNotes);
   noTone(8);
 }
}

void loop() {
}

---------------------xxxxxx---------------------
ERROR:

core.a(main.cpp.o): In function `main':
F:\Arduino and Processing\arduino-1.0\hardware\arduino\cores\arduino/main.cpp:11: undefined reference to `setup'
F:\Arduino and Processing\arduino-1.0\hardware\arduino\cores\arduino/main.cpp:14: undefined reference to `loop'

Please tell me what am i doing wrong.
Thanks.

Go Up