Question

I was programming with mbed's online compiler, but now I need debugging support and last night I exported to uVision 4. There seems to be an error when I compile the official libraries though.

mbed/KL25Z/gpio_object.h(33): warning: #260-D: explicit type issing ("int" assumed)
mbed/KL25Z/gpio_object.h(33): error: #65: expected a ";"

This code is the same on the other platforms as well. The code at line 33 looks like this...

static inline void gpio_write(gpio_t *obj, int value) {
    if (value)
        *obj->reg_set = obj->mask;
    else
        *obj->reg_clr = obj->mask;
}

I tried surrounding the if-else with braces and that didn't work, so now I don't know what to do...

Was it helpful?

Solution

By default C compilation is ISO C90 where the inline keyword is not valid. Use either:

  • the __inline C90 extension,
  • C++ compilation or
  • C99 compilation.

Without either of those, the C90 compiler parses the code as a declaration of a static variable called "inline" without an explicit type and a missing semi-colon.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top