【解决】Keil中创建工程时出现-arm_math.h(xxx): warning: #xxxx-D: unrecognized GCC pragma错误

场景:在搭建完Keil工程后进行编译,会出报错或者warning。


问题描述

搭建完Keil工程后进行编译后发现,统一都是GCC编译的问题。如下面的代码块里面所示。

compiling stm32f4xx_syscfg.c...
..\CORE\arm_math.h(293): warning:  #2803-D: unrecognized GCC pragma
  #pragma GCC diagnostic push
..\CORE\arm_math.h(294): warning:  #2803-D: unrecognized GCC pragma
  #pragma GCC diagnostic ignored "-Wsign-conversion"
..\CORE\arm_math.h(295): warning:  #2803-D: unrecognized GCC pragma
  #pragma GCC diagnostic ignored "-Wconversion"
..\CORE\arm_math.h(296): warning:  #2803-D: unrecognized GCC pragma
  #pragma GCC diagnostic ignored "-Wunused-parameter"
..\CORE\arm_math.h(7146): warning:  #2803-D: unrecognized GCC pragma
  #pragma GCC diagnostic pop
..\FWLIB\src\stm32f4xx_syscfg.c: 5 warnings, 0 errors
compiling stm32f4xx_can.c...
..\CORE\arm_math.h(293): warning:  #2803-D: unrecognized GCC pragma
  #pragma GCC diagnostic push

在这里插入图片描述


原因分析:

这是#paragrmGCCdiagnostic编译器警告的方法弃用警告,即上面代码块中所示。说人话,就是我们选用的编译器版本问题。直接上操作吧!

解决方案:

我们在 Options for Target(魔术棒)的 C++ 选项卡中取消勾选 C99 Mode和 GNU extensions 即可。点击 OK 保存退出!

在这里插入图片描述

重新编译,即成功了。

在这里插入图片描述
我可不允许你,还没点亮自己的第一个LED。就中道崩殂了哦!

  • 7
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

浅尝写博客的爽

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值