解决在nuttx系统中编译应用程序时缺少math.h的错误

最近Nuttx系统中编译自定义的应用,程序中使用了一些常用的数学函数,在进行编译时,报错:

arm-none-eabi-ld: /xxx/apps/examples/xxx.c:424: undefined reference to `sin'
arm-none-eabi-ld: /xxx/apps/examples/xxx.c:425: undefined reference to `cos'
arm-none-eabi-ld: /xxx/apps/examples/xxx.c:426: undefined reference to `sin'

明明程序中都包含了<math.h>的头文件,但就是一直报错,这个问题困扰了好几天,也在网上查找尝试了各种解决方法,均无果。

后来在nuttx中搜索关键词,发现在官方readme.txt文档中有这样一段表述:

 math.h

    Even though you should not use a foreign C-Library, you may still needto use other, external libraries with NuttX.  In particular, you may need to use the math library, libm.a.  NuttX supports a generic,      built-in math library that can be enabled using CONFIG_LIBM=y.  However, you may still want to use a higher performance external math library that has been tuned for your CPU.  Sometimes such     

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值