We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello, I'm getting following error message:
compiling RTX_Config.c... C:\Keil\ARM\RV31\INC\RTX_lib.c(185): error: #29: expected an expression
I'm using Keil uVision V4.71.2.0 tools. C compier Armcc.Exe version v5.03.0.69
Is the error in filename RTX_Config.c, line number 185?
No - look again:
C:\Keil\ARM\RV31\INC\RTX_lib.c(185): error: #29: expected an expression
The error refers to file RTX_lib.c, line 185.
However, such an error could quite possibly be caused by some earlier mistake - eg, a missing semicolon - such that the only way the compiler can make any sense of your source text is to assume that there should have been an expression at that point...
The following is the error from the compiler:
Build target 'Proj1_Debug' compiling RTX_Config.c... C:\Keil\ARM\RV31\INC\RTX_lib.c(185): error: #29: expected an expression Target not created
Line 185 in RTX_lib.c is as follows:
#if (__ARM__ && __RTA_RTX_CONFIG)
what might be the problem?
"what might be the problem?"
Did you read the answer you got earlier? What about the part:
"However, such an error could quite possibly be caused by some earlier mistake - eg, a missing semicolon - such that the only way the compiler can make any sense of your source text is to assume that there should have been an expression at that point..."
So have you looked at what source lines the compiler must have processed before it reached the line mentioned in the error message?
Remember that the convention among 'C' programmers is that symbols in ALL UPPERCASE are preprocessor macros.
So think how these preprocessor macros might expand:
#if( __ARM__ && __RTA_RTX_CONFIG )
Also, as previously mentioned, check for other syntax mistakes before that line...
Filename RTX_lib.c has the #if condition as follows:
#if (__ARM__ && __RTA_RTX_CONFIG) // error is "expected an expression"
Filename RTX_Config.c has the following definition:
#define __RTA_RTX_CONFIG
Now, this error makes sense. Since __RTA_RTX_CONFIG is empty, there is no expression. But I cannot understand how RTX_lib.c knows about __RTA_RTX_CONFIG because it's defined in a different .c file?
From your original post:
It looks like RTX_lib.c might be #included by RTX_Config.c ...?
It looks like RTX_lib.c might be #included by RTX_Config.c
Very likely. Keil have a habit of doing that with the extra packages of MDK professional.
At the end of RTX_Config.c, RTX_lib.c is included. I'm not used seeing files included at the end of a source file. I am only used to header files included at the beginning of source file.
THANK YOU SO MUCH FOR YOUR HELP!