C ++ - 包括unistd.h中:为什么不cunistd? [英] C++ - include unistd.h: why not cunistd?
问题描述
有人说,包括C ++ C头文件时,将.H后缀应该被删除,然后在开头添加C。例如,的#include< cstdio>
而不是的#include<&stdio.h中GT;
。但是当我使用睡眠()
在我的code,的#include< cunistd>
不起作用,但的#include<&unistd.h中GT;
的作品。为什么不< cunistd>
It's said that when including C header files in C++, the ".h" suffix should be removed and then add "c" at the beginning. For example, #include <cstdio>
instead of #include <stdio.h>
. But when I use sleep()
in my code, #include <cunistd>
does not work, but #include <unistd.h>
works. Why not <cunistd>
?
推荐答案
您的算法是大多数(全部?)标准的C头,但 unistd.h中
是不正确的反过来标准C所以C ++标准的一部分,不与其他ç...
头包含它。
Your algorithm is correct for most (all?) standard C headers, but unistd.h
is not part of standard C so standard C++ in turn doesn't include it with the other c...
headers.
这篇关于C ++ - 包括unistd.h中:为什么不cunistd?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!