Ç初学者:不能在一个简单的C程序中使用延迟() [英] C Beginner: Can't use delay() in a simple C program
本文介绍了Ç初学者:不能在一个简单的C程序中使用延迟()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
#include <stdio.h>
int main(void) {
printf("test\n");
delay(1000);
printf("test2\n");
}
当我尝试编译...
gcc test1.c -o test1
Undefined symbols for architecture x86_64:
"_delay", referenced from:
_main in ccUnw3tY.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
当然有前车之鉴在这里了解你的库中,哪些链接是等...我缺少什么?我试图做到这一点在OSX。
Certainly there is a lesson here in knowing your libraries and what linking is etc... What am I missing? I am trying to do this on OSX.
推荐答案
有在C无延时功能,你必须使用睡眠
或 usleep
取决于你在什么操作系统。
There's no delay function in C, you have to use sleep
or usleep
depending on what OS you're on.
这篇关于Ç初学者:不能在一个简单的C程序中使用延迟()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文