什么是在C函数“睡眠”正确的#include? [英] What is the proper #include for the function 'sleep' in C?

查看:186
本文介绍了什么是在C函数“睡眠”正确的#include?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我现在用的大牧场书呆子书Objective-C编程,它通过让我们写C中的前几章开始了。在我的计划已经创造了我一个,我用的是睡眠功能。在这本书中它告诉我把的#include<文件stdlib.h> 的#include< stdio.h中> 部分。这应该摆脱,上面写着功能休眠的隐式声明是无效C​​99的警告。但由于某些原因后,我把的#include<&stdlib.h中GT; ,警告将不会消失。这问题不从运行正常停止程序,但我只是好奇哪个的#include 我需要使用!

I am using the Big Nerd Ranch book Objective-C Programming, and it starts out by having us write in C in the first few chapters. In one of my programs it has me create, I use the sleep function. In the book it told me to put #include <stdlib.h> under the #include <stdio.h> part. This is supposed to get rid of the warning that says "Implicit declaration of function 'sleep' is invalid in C99". But for some reason after I put #include <stdlib.h>, the warning does not go away.. This problem does not stop the program from running fine, but I was just curious on which #include I needed to use!

推荐答案

睡眠手册页说,这是在&LT宣布; unistd.h中&GT; 。你有没有在你的程序包含在此?

The sleep man page says it is declared in <unistd.h>. Have you included this in your program?

这篇关于什么是在C函数“睡眠”正确的#include?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆