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
Solved! Go to Solution.
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
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
Wierd!
I haven't used C in a long while and was going crazy with this one.
Thanks for the help.