小编pgm*_*pgm的帖子

log10f()不是标准数学库的一部分吗?

我在使用log10f()时遇到问题.我正在Linux(2.6.28-11-generic)上编译程序并使用gcc(3.4.6).

以下源代码在执行时编译并打印1.000000.

#include <stdio.h>
#include <math.h>

int main() {
   printf("%f\n", log10f(10));
   return 0;
}
Run Code Online (Sandbox Code Playgroud)

而下面的一个没有并抛出链接错误:

#include <stdio.h>
#include <math.h>

int main() {
   printf("%f\n", log10f(100));
   return 0;
}
Run Code Online (Sandbox Code Playgroud)

错误:对log10f的未定义引用

  1. log10f()是否未定义为标准数学库的一部分(Man页面表明它是数学库的一部分)?

  2. 为什么第二个例子不编译?

gcc

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

标签 统计

gcc ×1