zoukankan      html  css  js  c++  java
  • 关于头文件

    用gcc编译一个程序,程序包含了“ourhdr.h”,但出现错误提示,没有这个头文件

    #include <sys/types.h>
    #include <dirent.h>
    #include <ourhdr.h>

    int main(int argc,char *argv[])
    {
        DIR             *dp;
        struct dirent   *dirp;
        if (argc !=2)
            err_quit("a single argument (the dirname) is required");
        if ((dp = opendir(argv[1])) == NULL)
            err_sys("can't open %s",argv[1]);
        while ((dirp = readdir(dp)) !=NULL)
        printf("%s\n",dirp->d_name);
        closedir(dp);
        exit(0);
    }

    编译的结果提示如下:list_allfile.c:3:60: ourhdr.h: 没有那个文件或目录
    list_allfile.c: In function `main':
    list_allfile.c:10: `NULL' undeclared (first use in this function)
    list_allfile.c:10: (Each undeclared identifier is reported only once
    list_allfile.c:10: for each function it appears in.)
    有朋友告诉我这个头文件是APUE里边的头文件

    应该怎么重新改写并编译一下呢?

  • 相关阅读:
    word 操作技巧
    有朝一日
    菜狗日记2021.7.10
    记一次JSON.toJSONString()踩坑
    菜狗日记2020.11.13
    菜狗日记2020.11.6
    菜狗日记2020.11.03
    菜狗日记2020.10.29
    菜狗日记2020.10.17
    菜狗日记2020.10.11
  • 原文地址:https://www.cnblogs.com/xinyult/p/1295983.html
Copyright © 2011-2022 走看看