Page 1 of 1

[DONE] Can not compile chprintf.c

Posted: Fri Jan 10, 2014 5:22 am
by plain
I am trying ChibiOS for a few day. I got the demo project compiled, but when I try to compile my project with chprintf.h included, the compiler reported some errors

Code: Select all

compiling chprintf.c...
..\..\..\os\various\chprintf.h(69): warning:  #260-D: explicit type is missing ("int" assumed)
  static inline void chprintf(BaseSequentialStream *chp, const char *fmt, ...) {
..\..\..\os\various\chprintf.h(69): error:  #65: expected a ";"
  static inline void chprintf(BaseSequentialStream *chp, const char *fmt, ...) {
..\..\..\os\various\memstreams.h(63): warning:  #12-D: parsing restarts here after previous syntax error
  };
..\..\..\os\various\chprintf.c: 2 warnings, 1 error

My compiler is Keil MDK v4.73.
Can any body tell me how to solve thi problem please?
Thanks & Regards

Re: Can not compile chprintf.c

Posted: Fri Jan 10, 2014 9:36 am
by Giovanni
Hi,

I will try it over the weekend.

Giovanni

Re: Can not compile chprintf.c

Posted: Fri Jan 10, 2014 10:44 am
by plain
Giovanni wrote:Hi,

I will try it over the weekend.

Giovanni


Thanks for your reply. I look forward hearing from you.

Re: Can not compile chprintf.c

Posted: Sat Jan 11, 2014 12:17 pm
by Giovanni
Hi,

It is a bug, that declaration uses a C99 keywork while the project is compiled in C90 mode.

Replace "inline" with "INLINE", the fix will be present in version 2.6.3.

Giovanni

Re: Can not compile chprintf.c

Posted: Sat Jan 11, 2014 4:40 pm
by plain
Giovanni wrote:Hi,

It is a bug, that declaration uses a C99 keywork while the project is compiled in C90 mode.

Replace "inline" with "INLINE", the fix will be present in version 2.6.3.

Giovanni


Thank you so much. I can compile it now :D

Re: [DONE] Can not compile chprintf.c

Posted: Tue Jan 14, 2014 1:32 pm
by daemon
Hello!

I have the same error. At first my workaround was to use __STATIC_INLINE from core_cm4.h (#include "hal.h") but now I am following Giovanni suggestion. The patch is:

Code: Select all

--- chprintf.h.old   2013-12-04 20:24:42.000000000 +0200
+++ chprintf.h   2014-01-14 14:25:06.000000000 +0200
@@ -66,7 +66,7 @@
  *
  * @api
  */
-static inline void chprintf(BaseSequentialStream *chp, const char *fmt, ...) {
+static INLINE void chprintf(BaseSequentialStream *chp, const char *fmt, ...) {
   va_list ap;
 
   va_start(ap, fmt);