Topic

FAQ
Login Register
关于TC32编译器库函数的使用问题 pow()函数
Jul 22, 2023 11:02

/

A

/A

Telink support team,

目前需要使用到pow()这个函数,经查阅Telink SDK ide的安装目录,其中:

C:\TelinkSDK\opt\tc32\lib\gcc\tc32-elf\4.5.1-tc32-1.3\include\tgmath.h文件中包含pow()函数声明,

C:\TelinkSDK\opt\tc32\tc32-elf\include\math.h文件中包含pow()函数声明。

在C:\TelinkSDK\opt\tc32\tc32-elf\lib中有见到3个库文件libc.a, libm.a, libg.a,经查阅libm.a应该是math相关的库。


问题: 在代码中include <math.h>或者<tgmath.h>并调用pow()函数,报错2处:

头文件include的时候报错:unresolved inclusion: <math.h>/<tgmath.h>, 

在函数调用处报错:undefined reference pow. 

请问下,在TC32目录下有包含.h文件,为什么会有unresolved inclusion的错误?

在.h文件中有见到这个函数的声明,为什么会有undefined  reference报错呢? 


在编译配置选项中没有见到内建函数使能的选项,我仍然尝试使用内建函数__builtin_pow(),在编译的时候,仍然报undefined reference pow错误。 

问题:TC32编译器与库函数对应的内建函数不能使用吗? 还是我没有配置正确?


1 replies
TL_Soyo Jul 24, 2023 13:45
0
/A

你好,

  8系列是不是math库的,需要你自行实现pow函数。