gpt4 book ai didi

c - 警告 : incompatible implicit declaration of built-in function log2

转载 作者:太空宇宙 更新时间:2023-11-04 05:28:10 25 4
gpt4 key购买 nike

<分区>

所以我们在 C 中有这个程序,我们需要使用以 2 为底的对数函数,以获得 n 的以 2 为底的对数。这是代码:

#include <math.h>

int partSize(int n) {
return log2(n);
}

但是在编译时,它给了我们以下警告。

sim.c: In function partSize : sim.c:114: warning: incompatible implicit declaration of built-in function log2

这是我们使用的命令

 gcc $file -o $name.out -lm 

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com