Below is some Processor Expert-generated code. I have a CAN bean (MainboardCan) and a PIT bean (MainTimer). The only change I have made to the code is to add a single int declaration, and the compiler gives me a C2801 error: '}' missing.
/* Including used modules for compiling procedure */#include "Cpu.h"#include "Events.h"#include "MainboardCan.h"#include "MainTimer.h"/* Include shared modules, which are used for whole project */#include "PE_Types.h"#include "PE_Error.h"#include "PE_Const.h"#include "IO_Map.h"void main(void){ /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/ PE_low_level_init(); /*** End of Processor Expert internal initialization. ***/ /* Write your code here */ int yeldarb; /* <--------- ERROR C2801 ???? */ /*** Don't write any code pass this line, or it will be deleted during code generation. ***/ /*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/ for(;;){} /*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/} /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/
Config:
FYI, when I change the type to, say, a byte, the compiler throws a C1815 error, telling me that there's no such typedef as byte. Now, I can right-click on byte, and the editor will take me straight to its typedef in PE_Types.h. The compiler, however, can't seem to find it. Pretty flakey.
Any ideas?
Thanks much for your help.
Message Edited by alex_spotw on 04-11-200610:28 AM
Doh!
[sigh] Forgive the stupid-user question. I guess I've been working too long in C++ and Java and JavaScript and VB and about any other language out there that doesn't care where you declare something. I'm so ashamed!
Thanks. I'll go back to work here with my tail between my legs.
Actually, it is Metrowerks that should be ashamed.
The Broad Lea wrote:. . . I'm so ashamed!
"It doesn't matter now. I know what the problem is, and anybody else who runs into it in the future will have this forum thread."
And that would be me. Thank you!
Yeh, I had same annoying problem. I was trying to declare a "byte" type variable in an ISR after assignment statement in ISR. When I moved it to a first line in that ISR it worked! So yes it has to be first item in a block.
Ok, 2014. I too had the same problem. Thanks to all on this thread.