小编JoM*_*oMP的帖子

警告:内置函数log2的不兼容的隐式声明

所以我们在C中有这个程序,我们需要使用base-2对数函数,得到n的基数2的对数.这是代码:

#include <math.h>

int partSize(int n) {
    return log2(n);
}
Run Code Online (Sandbox Code Playgroud)

但是在编译时,它会给我们以下警告.

sim.c:在函数中partSize:sim.c:114:警告:内置函数的不兼容隐式声明log2

这是我们使用的命令

 gcc $file -o $name.out -lm 
Run Code Online (Sandbox Code Playgroud)

c compiler-errors logarithm

0
推荐指数
1
解决办法
3865
查看次数

标签 统计

c ×1

compiler-errors ×1

logarithm ×1