} bracket missing message when I compile

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

} bracket missing message when I compile

Jump to solution
963 Views
z537z
Contributor I

I've got a nice flash write/erase project working in C++ but ran into the code size limit, so I'm moving to C code.

I keep getting a compile error and I've narrowed it down to this:

 

 

#include <hidef.h>      //for EnableInterrupts macro#include "derivative.h" //include peripheral declarationsvoid main(void){      //clock setup  ICSC1=0x04; //select Internal Clock Source    int i;  for (i = 0; i < 100; i++);  for(;;) {    __RESET_WATCHDOG();   } //for}//main

 

The int i; declaration gives me the error of C2801:  ' } 'missing  - if I move it above the ICSC1 register setting it compiles fine.

This should be stupid simple, but what am I missing here???

I'm using 32/64 float support if that makes a difference (created project with wizard).

Thanks

Labels (1)
Tags (1)
0 Kudos
1 Solution
478 Views
CompilerGuru
NXP Employee
NXP Employee

In C declarations have to be at the beginning of a scope.

E.g.

 

void main(void){  int i;      //clock setup  ICSC1=0x04; //select Internal Clock Source 

 

Daniel

 

View solution in original post

0 Kudos
2 Replies
479 Views
CompilerGuru
NXP Employee
NXP Employee

In C declarations have to be at the beginning of a scope.

E.g.

 

void main(void){  int i;      //clock setup  ICSC1=0x04; //select Internal Clock Source 

 

Daniel

 

0 Kudos
478 Views
z537z
Contributor I

Wierd!
I haven't used C in a long while and was going crazy with this one.

 

Thanks for the help.

0 Kudos