[求助]debian安装build-essential后,无法包含math函数库
debian吧
全部回复
仅看楼主
level 1
安装gcc的时候直接用的
apt-get install build-essential
debian版本是debian11
用到math.h头文件下面的log函数和sqrt函数,在编译那一步都报错说没有声明函数,是不是math库损坏了呀?不过stdio.h下面的函数都能正常使用。
报错内容:
text.c:(.text+0x29): undefined reference to 'sqrt'
collect2: error: ld returned 1 exit status
如果是math库出问题的话要怎么解决呢?csdn和百度都没有找到方法
2021年10月04日 10点10分 1
level 1
编译时候要手动指定数学库,gcc 1.c -lm
2021年10月13日 06点10分 2
1