这是我的代码。
#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/