c - gcc 中的 atan2() 奇怪行为,w_atan2.c : No such file or directory

标签 c gcc atan2

我在代码中包含了 math.h 并使用了 -lm,但是当我使用 gcc 调试器处理 atan2() 时,我得到以下结果:

16      result = atan2(x,y) * val;

(gdb) 

__atan2 (y=15, x=32) at w_atan2.c:31
31  w_atan2.c: No such file or directory.
(gdb) 

34  in w_atan2.c

(gdb) 

__ieee754_atan2_sse2 (y=15, x=32) at ../sysdeps/ieee754/dbl-64/e_atan2.c:92

我的代码是

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

#define PI 3.14159265


main(){

    double x, y, val, result;

    val = 180 / PI;
    x = 15;
    y = 32;

    result = atan2(x,y) * val;
    printf("%lf\n",result);

}

最佳答案

尽我所能,通过在调试器中在 result = atan2(x,y) * val; 行之前输入 step 来告诉 gdb进入 atan2 函数,如果您没有源代码,该函数将无法工作。您可能不需要调试 atan2,因此 next 可能是您想要的命令。

如果您在此之后继续单步执行,那么当您点击 printf 时,您会遇到类似的错误,因为您也无法单步执行。如果您确实想在库函数上运行调试器,这里有一些讨论:http://ubuntuforums.org/showthread.php?t=1374829

关于c - gcc 中的 atan2() 奇怪行为,w_atan2.c : No such file or directory,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23374526/

相关文章:

c++ - 如何在 XCode 7 中应用支持 OpenMP

ios - 旋转 UIView(再次)

c - C 语言的基本 CLI 程序

找不到符号 "Embeddedrcall_Init"

c - mmap 对于不同的文件大小表现不同

linux - 如何查找哪个库导出了函数?

c - 如何知道一个c程序的堆栈溢出?

c++ - GCC 可以配置为忽略#pragma 指令吗?

assembly - 使用 ARM NEON 汇编对 atan2 进行 SIMD 向量化

JavaScript atan2() 函数没有给出预期的结果