So I am working on my final project and when I try to compile I get this error :

mpg.c:169:1: error: expected '}'
mpg.c:133:2: note: to match this '{'
mpg.c:169:1: error: expected '}'
mpg.c:97:1: note: to match this '{'
2 errors generated.

I know this might seem as a trivial question but I read through my code several times and made several changes that I suspected to be causing this error thought I know they don't and nothing is working. Can you help

here is my code


1 Answer 1


It's exactly what it says, a straight up missing closing curly brace. Try counting them for yourself. Starting with the beginning of the bitnumber() function at line 96, start counting +1 for each { and -1 for each }. When you get to the end, the final count should be 0, but it's 1. That means you're missing a closing curly brace - either the last one for the function, or an intermediate one. Or, there's one possible case that you've done something wrong with a curly brace. (I found the issue, but what fun would it be for you if I told you? ;-) )

If you really want to know....

What happens when you insert the wrong curly brace?

If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-)

  • Indeed It's a trivial mistake, do not worry, also I've gone crazy with
    – MARS
    Dec 8, 2016 at 20:39
  • 1
    One little additional tip: in the IDE, if you click immediately after one curly brace, the matching curly brace is highlighted. Dec 8, 2016 at 21:54
  • OK, show of hands - how many of you commenters have actually found the problem? ;-)
    – Cliff B
    Dec 8, 2016 at 22:06
  • I was asking for a show of hands, not for you to post the answer! sheesh! :-P Maybe you could delete the comment? :-)
    – Cliff B
    Dec 9, 2016 at 1:07
  • I am not actually using the IDE any more, since I installed all the tools on my linux Computer. my Gedit version doesn't cooperate :(
    – A.Emad
    Dec 9, 2016 at 12:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .