gpt4 book ai didi

C++ - 包括 unistd.h : why not cunistd?

转载 作者:IT老高 更新时间:2023-10-28 13:20:50 27 4
gpt4 key购买 nike

据说在C++中包含C头文件时,要去掉“.h”后缀,然后在开头加上“c”。例如,#include <cstdio>而不是 #include <stdio.h> .但是当我使用 sleep()在我的代码中,#include <cunistd>不起作用,但是 #include <unistd.h>作品。为什么不 <cunistd> ?

最佳答案

您的算法对于大多数(全部?)标准 C 头文件都是正确的,但 unistd.h 不是标准 C 的一部分,因此标准 C++ 反过来不包含它与其他 c... header 。

关于C++ - 包括 unistd.h : why not cunistd?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15331566/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com