I have defined a function in the Function editor, saved it, then tried to compile, and I get a compile error:
FUNC void FooBar (void) { printf("foobar"); } ^ *** error 10, line 3: Syntax error *** Function creation aborted due to syntax errors
FUNC void FooBar (void) { printf("foobar"); }
Thanks for enlightening the issue. That cleared it up.
"Debug Function Code in the uVision IDE, which technically is 'C'" No, it is not. It is something like 'C', but it certainly is not 'C'. See the uVision Getting Started guide for a full list of the differences between Debug Functions and "real" 'C'
Nik; The problem is no line fed-carriage return after the last line of code. This simple editor looks for LF/CR as the end of line delimiter. While it looks like C code, it really is a script file that is interpreted after each line just as if you typed the line in the command line. So, you must end each line with CR/LF. You cannot have line continuation as in the C language.
This is Debug Function Code in the uVision IDE, which technically is 'C', but is only available to you in their debugger, to allow looking at variables, etc. while debugging.
"This is copied right out of my functions.ini file" Uh, sorry, I thought I was looking at 'C' code. I've never used that stuff.
When I went back and exited the debugger, made a code change in my project source, re-compiled, then went back to the debugger and tried to compile the debug function, it compiled and ran fine. Maybe there's a weird workflow issue I need to figure out.
This is copied right out of my functions.ini file:
FUNC void FooBar (void) { printf("foobar\n"); }
Can you show your definition of 'FUNC'?
I spoke too soon, it compilesbut When I try to run it from the command bar, I get:
FooBar() *** error 34: undefined identifier
View all questions in Keil forum