Annoying compiler error...

Go To Last Post
4 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi there!

I am completing my first AVR GCC project; a small circuit to communicate with the COMM port of my Casio calculator :lol:

Anyway, my C code compiles fine in Dev-C++ (XP), and in plain gcc (Linux). However, AVR Studio gives the following error:

avr-gcc.exe  -mmcu=atmega16 -Wall -gdwarf-2 -O0 -MD -MP -MT test.o -MF dep/test.o.d  -c  ../test.c

../test.c: In function 'main':
../test.c:222: error: expected declaration or statement at end of input
make: *** [test.o] Error 1
Build failed with 1 errors and 0 warnings...

What does that mean; there seems to me to be nothing wicked going on in line 222, the end of the code...? Here's a snip from the attached source file:

...snip...

  checksum = 0x3A - checksum;
  //checksum = 0xFF ^ checksum;
  //checksum += 0x01;

/*
  printf("\nNegated checksum is %x (%x)\n", checksum, den[len-1]);
  if (checksum == den[len-1]) printf("\033[32mEqual!");
  else printf("\033[31mNot equal...");
  printf("\033[0m\n\n");
*/
}


Perhaps someone would try compiling it on their PC? I have attached the file (test.c) to this post, perhaps someone can spot a syntax error?

Thanks!

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Unmatched braces.

After the for() you start a code section. Then within that you have an if() and it starts another code section.

Before you get to the return 0 we only encounter ONE, not two closing braces.

(if you made your indentation more obvious this error would also have been!)

Cliff

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

OMG...
Note to self: Delete this post immediately :oops:

Thank you clawson!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
Unmatched braces.
Well, all I can say is I've never done that. Ah, that is . . . not today, anyway.

Don