设为首页收藏本站

Discuz! Board

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
热搜: 活动 交友 discuz
查看: 2484|回复: 2
打印 上一主题 下一主题

点亮LED灯编译不通过

[复制链接]

1

主题

4

帖子

31

积分

新手上路

Rank: 1

积分
31
跳转到指定楼层
楼主
照月cool 发表于 2022-2-15 23:10:32 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
照视频,把下载的示例复制过来后,在keil5中,编译失败。新手刚上手,发贴请教各位大佬。
编译错误内容如下:
  1. *** Using Compiler 'V5.06 update 1 (build 61)', folder: 'C:\Keil_v5\ARM\ARMCC\Bin'
  2. Rebuild target 'Target 1'
  3. compiling main.c...
  4. ..\..\integration\nrfx\nrfx_glue.h(104): warning:  #260-D: explicit type is missing ("int" assumed)
  5.   static inline void _NRFX_IRQ_PRIORITY_SET(IRQn_Type irq_number,
  6. ..\..\integration\nrfx\nrfx_glue.h(104): error:  #65: expected a ";"
  7.   static inline void _NRFX_IRQ_PRIORITY_SET(IRQn_Type irq_number,
  8. ..\..\modules\nrfx\soc/nrfx_coredep.h(161): error:  #268: declaration may not appear after executable statement in block
  9.       
  10. _ALIGN(16)
  11. ..\..\modules\nrfx\soc/nrfx_coredep.h(168): error:  #268: declaration may not appear after executable statement in block
  12.       typedef void (* delay_func_t)(uint32_t);
  13. ..\..\modules\nrfx\soc/nrfx_coredep.h(169): error:  #268: declaration may not appear after executable statement in block
  14.       const delay_func_t delay_cycles =
  15. ..\..\modules\nrfx\soc/nrfx_coredep.h(172): error:  #268: declaration may not appear after executable statement in block
  16.       uint32_t cycles = time_us * NRFX_DELAY_CPU_FREQ_MHZ;
  17. ..\..\modules\nrfx\hal\nrf_gpio.h(797): error:  #268: declaration may not appear after executable statement in block
  18.       uint32_t i;
  19. ..\..\drive\led.h(28): warning:  #1-D: last line of file ends without a newline
  20.   #endif /* __LED_H */
  21. ..\main.c(44): warning:  #1-D: last line of file ends without a newline
  22.   }
  23. ..\main.c: 3 warnings, 6 errors
  24. compiling led.c...
  25. ..\..\integration\nrfx\nrfx_glue.h(104): warning:  #260-D: explicit type is missing ("int" assumed)
  26.   static inline void _NRFX_IRQ_PRIORITY_SET(IRQn_Type irq_number,
  27. ..\..\integration\nrfx\nrfx_glue.h(104): error:  #65: expected a ";"
  28.   static inline void _NRFX_IRQ_PRIORITY_SET(IRQn_Type irq_number,
  29. ..\..\modules\nrfx\soc/nrfx_coredep.h(161): error:  #268: declaration may not appear after executable statement in block
  30.       
  31. _ALIGN(16)
  32. ..\..\modules\nrfx\soc/nrfx_coredep.h(168): error:  #268: declaration may not appear after executable statement in block
  33.       typedef void (* delay_func_t)(uint32_t);
  34. ..\..\modules\nrfx\soc/nrfx_coredep.h(169): error:  #268: declaration may not appear after executable statement in block
  35.       const delay_func_t delay_cycles =
  36. ..\..\modules\nrfx\soc/nrfx_coredep.h(172): error:  #268: declaration may not appear after executable statement in block
  37.       uint32_t cycles = time_us * NRFX_DELAY_CPU_FREQ_MHZ;
  38. ..\..\modules\nrfx\hal\nrf_gpio.h(797): error:  #268: declaration may not appear after executable statement in block
  39.       uint32_t i;
  40. ..\..\drive\led.h(28): warning:  #1-D: last line of file ends without a newline
  41.   #endif /* __LED_H */
  42. ..\..\drive\led.c: 2 warnings, 6 errors
  43. assembling arm_startup_nrf52.s...
  44. compiling system_nrf52.c...
  45. ".\Objects\LED.axf" - 12 Error(s), 5 Warning(s).
  46. Target not created.
  47. Build Time Elapsed:  00:00:03
复制代码
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

1

主题

4

帖子

31

积分

新手上路

Rank: 1

积分
31
沙发
 楼主| 照月cool 发表于 2022-2-15 23:14:02 | 只看该作者
使用的是 nRF5SDK1702d674dde 的SDK,nRF52832
回复 支持 反对

使用道具 举报

1

主题

4

帖子

31

积分

新手上路

Rank: 1

积分
31
板凳
 楼主| 照月cool 发表于 2022-2-17 22:59:37 | 只看该作者
最终还是自己解决了,解决方法是:在项目的Options中的c/c++选项卡中勾选 C99Mode
回复 支持 反对

使用道具 举报

Archiver|手机版|小黑屋|Comsenz Inc.   

GMT+8, 2024-5-3 11:27 , Processed in 0.512380 second(s), 28 queries .

Powered by Discuz! X3

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表