I'm using uVision 5.14 and this is the error I receive when I try to use the '#message' directive:
error: #11-D: unrecognized preprocessing directive #message
Am I missing something?
I think the language standard only has #error
I think both #message and #warning are proprietary extensions - which, therefore, may not be supported.
What I wanted to use the #message for is a status output indicating build's parameters. The difference between #message and #warning is mainly the intention: warning means there is something potentially wrong; message is more neutral. Plus warning output just takes more space in the build log.
My bad, I was looking at Cx51's, not ARM's documentation.
Are you missing something? That depends on what expectations you have and what reference documentation you based your expectations on.
But you might consider:
#define CHARLIE #if defined(CHARLIE) #warning "Charlie was defined" #else #error "Charlie is undefined" #endif
"#warning" will give you a warning printout with your message text in the build log but will build the project.
*** Using Compiler 'V5.05 update 2 (build 169)', folder: 'C:\Keil_v5\ARM\ARMCC\Bin' Build target 'Target 1' compiling main.c... main.c(4): warning: #1215-D: #warning directive: "Charlie was defined" #warning "Charlie was defined" main.c: 1 warning, 0 errors linking... Program Size: Code=312 RO-data=456 RW-data=0 ZI-data=608 ".\Objects\test-1768.axf" - 0 Error(s), 2 Warning(s). Build Time Elapsed: 00:00:00
While #error" will produce a compilation error with your text message:
Build target 'Target 1' compiling main.c... main.c(7): error: #35: #error directive: "Charlie is undefined" #error "Charlie is undefined" main.c: 0 warnings, 1 error ".\Objects\test-1768.axf" - 1 Error(s), 0 Warning(s). Target not created. Build Time Elapsed: 00:00:00
Exactly what are your needs for non-warning and non-error messages during the build?
Where is it claimed that a #message directive is supported ?
Oh and BTW, my compiler is:
Armcc.exe V5.05 update 1 (build 106)
View all questions in Keil forum