0

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...

4

1 回答 1

4

默认情况下,C 编译是 ISO C90,其中inline关键字无效。使用任一:

  • __inlineC90 扩展,
  • C++ 编译或
  • C99 编译。

如果没有其中任何一个,C90 编译器会将代码解析为一个名为“inline”的静态变量的声明,而没有显式类型和缺少分号。

于 2013-05-13T14:17:49.497 回答