|
本帖最后由 buglovebug 于 2022-4-28 23:41 编辑
大家好,今天编译一个nRF52840的工程,碰到下面奇怪的报错,我已经把所有的多余的空格,多余的回车和任何能想到的语法错误都想到了,但是出现下面的报错.
唯一的共同点是,这两个语句中都是2进制的枚举类型,其他不是二进制的枚举类型都没有报错,当我把二进制改成十进制,就没问题,希望大侠帮忙指点一下.
另外,我编译官方提供的随便一个例子,编译没有错误之后,把下面的代码复制进去,也会出现同样的报错,真是很费解.- typedef enum{ONESHOT_PRESSED = 0b01, ONESHOT_OTHER_KEY_PRESSED = 0b10, ONESHOT_START = 0b11, ONESHOT_TOGGLED = 0b100} oneshot_fullfillment_t;
复制代码- enum action_kind_id{
- /* Key Actions */
- ACT_MODS = 0b0000,
- ACT_LMODS = 0b0000,
- ACT_RMODS = 0b0001,
- ACT_MODS_TAP = 0b0010,
- ACT_LMODS_TAP = 0b0010,
- ACT_RMODS_TAP = 0b0011,
- /* Other Keys */
- ACT_USAGE = 0b0100,
- ACT_MOUSEKEY = 0b0101,
- /* One-hand Support */
- ACT_SWAP_HANDS = 0b0110,
- /* Layer Actions */
- ACT_LAYER = 0b1000,
- ACT_LAYER_MODS = 0b1001,
- ACT_LAYER_TAP = 0b1010, /* Layer 0-15 */
- ACT_LAYER_TAP_EXT = 0b1011, /* Layer 16-31 */
- /* Extensions */
- ACT_MACRO = 0b1100,
- ACT_BACKLIGHT = 0b1101,
- ACT_COMMAND = 0b1110,
- ACT_FUNCTION = 0b1111
- };
复制代码 Build started: Project: ble_app_hids_keyboard_pca10056_s140
*** Using Compiler 'V5.06 update 7 (build 960)', folder: 'C:\Keil_v5\ARM\ARMCC\Bin'
Build target 'nrf52840_xxaa'
Note: source file '.\src\main.c' - object file renamed from '.\_build\main.o' to '.\_build\main_1.o'.
compiling ble_hids_service.c...
.\tmk_core\action_code.h(104): error: #67: expected a "}"
ACT_MODS = 0b0000,
.\tmk_core\action_code.h(125): warning: #12-D: parsing restarts here after previous syntax error
};
src\ble\ble_hids_service.c(13): warning: #550-D: variable "m_in_boot_mode" was set but never used
static bool m_in_boot_mode = false; /**< Current protocol mode. */
src\ble\ble_hids_service.c: 2 warnings, 1 error
compiling keymap.c...
.\tmk_core\action_code.h(104): error: #67: expected a "}"
ACT_MODS = 0b0000,
.\tmk_core\action_code.h(125): warning: #12-D: parsing restarts here after previous syntax error
};
.\tmk_core\action_util.h(74): error: #67: expected a "}"
typedef enum{ONESHOT_PRESSED = 0b01, ONESHOT_OTHER_KEY_PRESSED = 0b10, ONESHOT_START = 0b11, ONESHOT_TOGGLED = 0b100} oneshot_fullfillment_t;
src\keyboard\keymaps\default\keymap.c: 1 warning, 2 errors
".\_build\nrf52840_xxaa.axf" - 3 Error(s), 3 Warning(s).
Target not created.
|
|