C中未知类型名称'uid_t'

时间:2019-07-10 14:50:24

标签: c types compiler-errors codeblocks

我正在开发一个程序,该程序收集在结构中由用户提供的某个路径上调用的系统调用stat()的结果,然后将所有信息存储在文件中。我在Windows 10上使用CodeBlocks,当尝试构建时,输出如下:

error : unknown type name 'uid_t'
error : unknown type name 'gid_t'
error : unknown type name 'uid_t'
error : unknown type name 'gid_t'
error : unknown type name 'nlink_t'

以下是头文件,在其中定义了我需要的所有结构,并且在发生错误的地方,该文件称为“ structs.h”:

#ifndef STRUCTS
#define STRUCTS

#include <sys/types.h>
#include <time.h>

#define HASOPT(OPTIONS, OPT) (OPTIONS & OPT) == OPT

#define T_INODE 'I'
#define T_SCANNED_PATH 'S'

#define MALLOC_ERROR "[Error]: Out of memory\n"

typedef struct s_input_file_argument{
    char *path;
    unsigned char options;
    struct s_input_file_argument *next;
} input_file_argument;

typedef struct s_filestat_configuration{
    unsigned char hasopt;
    char *history;
    uid_t user;
    gid_t group;
    off_t length_min;
    off_t length_max;
    char *output_file;
    input_file_argument *input_args;
} filestat_configuration;

typedef struct s_file_info{
    time_t date;
    uid_t uid;
    gid_t gid;
    off_t size;
    mode_t mode;
    time_t actime;
    time_t ctime;
    time_t mtime;
    nlink_t nlink;
    struct s_file_info *next;
} file_info;

typedef struct s_path {
    char *path;
    file_info *head;
    file_info *tail;
} scanned_path;

typedef struct s_program_stats{
    unsigned long int nfiles;
    off_t max_size;
    double execution_time;
} program_report;

typedef union u_treenode_data{
    scanned_path *file;
    ino_t inode;
} u_data;

typedef struct s_treenode_data{
    unsigned char type;
    union u_treenode_data data;
} treenode_data;

#endif

我知道这些类型随“ sys / types.h”一起提供,所以为什么我遇到这个问题以及如何解决呢?

0 个答案:

没有答案