架构x86_64的未定义符号在C中的含义是什么?

这是我的代码。

#include  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

你需要在你的代码中包含#include文件的delay()函数,它没有在stdio.h定义

但我建议不要使用它,而是使用大多数基于Unix的操作系统建议unsigned int sleep(unsigned int seconds); 来自#include 函数。

读取不要使用延迟()

使用sleep()而不是delay()

EX: sleep(1) = 1秒延迟

这里你得到的错误是表单加载器

 ld: symbol(s) not found for architecture x86_64 

我不确定但是检查您的可执行文件中是否存在符号。

使用nm命令检查可执行文件中存在的符号。

http://linux.die.net/man/1/nm

GCC使用sleep()不支持delay() sleep()

http://pubs.opengroup.org/onlinepubs/009695399/functions/sleep.html