Go Down

Topic: error: a function-definition is not allowed here before '{' token (Read 859 times) previous topic - next topic

tankanator

I'm trying to implement this song into my program and it's giving me this error:  

In function 'void Mario()':
446:1: error: a function-definition is not allowed here before '{' token
452:1: error: a function-definition is not allowed here before '{' token
460:13: error: a function-definition is not allowed here before '{' token
527:10: error: expected '}' at end of input

I've done multiple searches on the internet for this and nothing is working.  If you could point out the problem and hopefully fix it that would be great!

Here is the code:

larryd

No technical PMs.
If you are asked a question, please respond with an answer.
If you are asked for more information, please supply it.
If you need clarification, ask for help.

tankanator


larryd

Most people will not open a .DOC file.



°·
No technical PMs.
If you are asked a question, please respond with an answer.
If you are asked for more information, please supply it.
If you need clarification, ask for help.

PaulMurrayCbr

Almost certainly a brace-nesting issue. Use ctrl or apple-T to reformat your code. This will line up everything according to where your compiler thinks the indenting is. Find the spot where the indenting doesn't match what you think its supposed to be, and add or remove a brace.

PaulS

Or at least pay attention to the message that the number of { and } do not match,

TomGeorge

Hi,

Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

What is your sketch supposed to do?
What does your sketch do that is wrong?
What model arduino and version IDE?

Before you post your code, goto  TOOLS and select AUTO FORMAT
It will detent your code and you will be able to see where you may have too many or not enough  { or } .

Thanks.. Tom.. :)
PS  Why have you got two "void setup()" and two "void loop()" functions?
Everything runs on smoke, let the smoke out, it stops running....

tankanator

Ok, so I'm trying to make an alarm clock that when the alarm goes off, it changes tune when the PIR sensor senses motion.  I would have liked to format this code in a more clearer one, but I'm trying to do this from home on project ignite's simulator, it's a school project I'm doing.  I have multiple void setups and loops because the code for the second tune is a code that I got from somewhere else, and I'm trying to merge it to the alarm clock code so it will play the mario tune when the PIR sensor senses motion.

Go Up