c - 体系结构 x86_64 的 undefined symbol 在 C 中意味着什么?

标签 c gcc compiler-errors

这是我的代码。

#include <stdio.h>

int main(){
int first;
int second;
int third;
float average=0.0;

    printf ("This program will find the average of 3 numbers.\n");
    delay(1000);
    printf ("Type the first number.\n");
    scanf ("%d", &first);
    printf ("Type the second number.\n");
    scanf ("%d", &second);
    printf ("Type the third number.\n");
    scanf ("%d", &third);
    average = (first+second+third)/2.0;
    printf ("The average of %d, %d, and %d is %.3f\n", first, second, third, average);

return (0);
}

当我用gcc编译的时候说

Undefined symbols for architecture x86_64:
  "_delay", referenced from:
      _main in cc62F0GD.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status

我是编码初学者。这是什么意思,我该如何解决?

最佳答案

编辑

由于代码是在 linux 环境中运行的,因此您可以使用 sleep 而不是 delay。头文件是unistd.h

关于c - 体系结构 x86_64 的 undefined symbol 在 C 中意味着什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17793445/

相关文章:

c - 错误收集2 : ld returned exit status

c - 在 XLC 编译器中使用内联汇编时如何避免标签翻译?

gcc - 为什么需要链接脚本和启动代码?

java - JUnit和Windows命令行的Javac编译问题

c# - 项目无法编译

c - 在 C 中,如何使常量仅对特定源文件可见?

c - 出现一个额外的输入

python - 使用 Cython 进行扩展,名称与源文件不同

gcc - 为什么使用 arm-linux-gnueabi-gcc 编译时堆栈指针比堆栈帧大小向下移动 4 个字节?

java - 创建对话框时出现不兼容类型错误