rt thread studio中调用math.h里的函数找不到
使用rt thread studio编译器函数中调用fmod() sin()等函数报错,头文件已经添加了math.h的头问题了
提示:undefined reference to `sin'
根本原因是没找到xxx函数的实现代码,应该是没有链接m库(数学库)
一般是通过-lm添加
如果使用的有rt thread操作系统,只需要开启libc就可以了。
如果使用裸机开发,需要在工程属性里添加-lm
再次编译,问题解决。
使用rt thread studio编译器函数中调用fmod() sin()等函数报错,头文件已经添加了math.h的头问题了
提示:undefined reference to `sin'
根本原因是没找到xxx函数的实现代码,应该是没有链接m库(数学库)
一般是通过-lm添加
如果使用的有rt thread操作系统,只需要开启libc就可以了。
如果使用裸机开发,需要在工程属性里添加-lm
再次编译,问题解决。