- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Alright, this is going to make me look really stupid, but I have searched for this error message and got zero results. I like to add an obvious indication to my code so that I know that the code loaded and at least this simple function is working, if not the others. For the following code:
#include <project.h>
int main()
{
CyGlobalIntEnable; /* Enable global interrupts. */
uint8 LED_On = 0;
/* Place your initialization/startup code here (e.g. MyInst_Start()) */
for(;;)
{
/* Place your application code here. */
LED_Write(LED_On);
CyDelay(500);
LED_On = !LED_On;
}
}
I get the following errors:
Build error: syntax error near 'uint8' (I assume that "uint8" is a valid type)
Build error: 'LED_On': undefined identifier (one per line that LED_On appears in).
I can't figure out how something so basic is a problem except that I need to include another library and I find nothing that tells me what to include. What resource tells me how to write C for Creator?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Jeffery,
move the variable definition of 'LED_On' at the first position in main() function (above interrupt enable) and try again.
If I remember correctly the Keil compiler doesn't allow definitions/declarations 'in the middle of the code'.
Regards,
Ralf