【问题标题】:no such a file or directory没有这样的文件或目录
【发布时间】:2015-02-20 08:01:17
【问题描述】:

我正在使用 ubuntu 14.04 LTS 并尝试按如下方式运行 prog1.c:

#include<stdio.h>
#include<usr/include/sys/types.h>

int main()
{
printf("Hello World");
}

$gcc prog1.c

并得到错误“致命错误:/usr/include/sys/types.h :no such a file or directory”

帮帮我

【问题讨论】:

    标签: c ubuntu systypes.h


    【解决方案1】:

    删除第二个#include 行。您没有使用来自 sys/types.h 的任何声明。

    如果您确实想开始使用它们,添加包含的正确方法是:

    #include <sys/types.h>
    

    【讨论】:

    • 确实,让编译器整理出来比硬编码更便于移植
    猜你喜欢
    • 2021-06-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-06-17
    • 2016-05-06
    • 2019-03-13
    • 2020-06-26
    相关资源
    最近更新 更多