OpenHarmony开发者论坛

标题: 轻量级liteos-m鸿蒙 math.h 里的函数无法被调用(undefined reference to sin) [打印本页]

作者: lovers1987    时间: 2024-9-30 21:36
标题: 轻量级liteos-m鸿蒙 math.h 里的函数无法被调用(undefined reference to sin)
[md]### 【问题描述】

1. 相关的代码(请勿使用截图)

   **sin()函数最简单的运算。**
2. 介绍问题现象和发生的背景
   **liteos-m 任务里调用math.h 里sin、atan等函数,编译过程error:undefined reference to “sin”**
3. 运行结果、错误截图

   ![问题.jpg](https://forums-obs.openharmony.c ... v8dvu7obhvksoga.jpg "问题.jpg")
4. 我尝试过的解决方法和结果
   **按照网上说法 添加”-lm“**

   ![企业微信截图_1727703197898.png](https://forums-obs.openharmony.c ... fotzmfwwv6fsomf.png "企业微信截图_1727703197898.png")
5. 我想要达到的结果

   **正常编译通过,调用sin等三角函数运算**

### 【运行环境】

硬件:GD32F470
ROM版本:无
DevEvoStudio版本:无
SDK版本:电鸿
[/md]
作者: fengyunrenwu    时间: 3 天前
csg这个目录是你自己创建的么
作者: alubw    时间: 3 天前
device/soc/gigadevice/gd32f4xx/board/BUILD.gn里的libs解注释math库再编译




欢迎光临 OpenHarmony开发者论坛 (https://forums.openharmony.cn/) Powered by Discuz! X3.5