照月cool 发表于 2022-2-15 23:10:32

点亮LED灯编译不通过

照视频,把下载的示例复制过来后,在keil5中,编译失败。新手刚上手,发贴请教各位大佬。
编译错误内容如下:*** Using Compiler 'V5.06 update 1 (build 61)', folder: 'C:\Keil_v5\ARM\ARMCC\Bin'
Rebuild target 'Target 1'
compiling main.c...
..\..\integration\nrfx\nrfx_glue.h(104): warning:#260-D: explicit type is missing ("int" assumed)
static inline void _NRFX_IRQ_PRIORITY_SET(IRQn_Type irq_number,
..\..\integration\nrfx\nrfx_glue.h(104): error:#65: expected a ";"
static inline void _NRFX_IRQ_PRIORITY_SET(IRQn_Type irq_number,
..\..\modules\nrfx\soc/nrfx_coredep.h(161): error:#268: declaration may not appear after executable statement in block
      
_ALIGN(16)
..\..\modules\nrfx\soc/nrfx_coredep.h(168): error:#268: declaration may not appear after executable statement in block
      typedef void (* delay_func_t)(uint32_t);
..\..\modules\nrfx\soc/nrfx_coredep.h(169): error:#268: declaration may not appear after executable statement in block
      const delay_func_t delay_cycles =
..\..\modules\nrfx\soc/nrfx_coredep.h(172): error:#268: declaration may not appear after executable statement in block
      uint32_t cycles = time_us * NRFX_DELAY_CPU_FREQ_MHZ;
..\..\modules\nrfx\hal\nrf_gpio.h(797): error:#268: declaration may not appear after executable statement in block
      uint32_t i;
..\..\drive\led.h(28): warning:#1-D: last line of file ends without a newline
#endif /* __LED_H */
..\main.c(44): warning:#1-D: last line of file ends without a newline
}
..\main.c: 3 warnings, 6 errors
compiling led.c...
..\..\integration\nrfx\nrfx_glue.h(104): warning:#260-D: explicit type is missing ("int" assumed)
static inline void _NRFX_IRQ_PRIORITY_SET(IRQn_Type irq_number,
..\..\integration\nrfx\nrfx_glue.h(104): error:#65: expected a ";"
static inline void _NRFX_IRQ_PRIORITY_SET(IRQn_Type irq_number,
..\..\modules\nrfx\soc/nrfx_coredep.h(161): error:#268: declaration may not appear after executable statement in block
      
_ALIGN(16)
..\..\modules\nrfx\soc/nrfx_coredep.h(168): error:#268: declaration may not appear after executable statement in block
      typedef void (* delay_func_t)(uint32_t);
..\..\modules\nrfx\soc/nrfx_coredep.h(169): error:#268: declaration may not appear after executable statement in block
      const delay_func_t delay_cycles =
..\..\modules\nrfx\soc/nrfx_coredep.h(172): error:#268: declaration may not appear after executable statement in block
      uint32_t cycles = time_us * NRFX_DELAY_CPU_FREQ_MHZ;
..\..\modules\nrfx\hal\nrf_gpio.h(797): error:#268: declaration may not appear after executable statement in block
      uint32_t i;
..\..\drive\led.h(28): warning:#1-D: last line of file ends without a newline
#endif /* __LED_H */
..\..\drive\led.c: 2 warnings, 6 errors
assembling arm_startup_nrf52.s...
compiling system_nrf52.c...
".\Objects\LED.axf" - 12 Error(s), 5 Warning(s).
Target not created.
Build Time Elapsed:00:00:03

照月cool 发表于 2022-2-15 23:14:02

使用的是 nRF5SDK1702d674dde 的SDK,nRF52832

照月cool 发表于 2022-2-17 22:59:37

最终还是自己解决了,解决方法是:在项目的Options中的c/c++选项卡中勾选 C99Mode
页: [1]
查看完整版本: 点亮LED灯编译不通过