} bracket missing message when I compile

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

} bracket missing message when I compile

跳至解决方案
1,602 次查看
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

标签 (1)
标记 (1)
0 项奖励
回复
1 解答
1,117 次查看
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 项奖励
回复
2 回复数
1,118 次查看
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 项奖励
回复
1,117 次查看
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 项奖励
回复