-3

这是我的头文件,它包含在另一个文件中但尚未使用:

#define ksm_read 0X01
#define ksm_rdwr 0x00

struct ksm_info_t {
    uint ksmsz; //size of shared mem
    int cpid;   //pid of the creator
    int mpid;   //pid of the last modifier
    uint attached_nr; //number of attached processes
    uint atime; //last attached time
    uint dtime; //last deattach time
    uint total_shrg_nr; //total number of existing shared regions
    uint total_shpg_nr; //total number of existing shared pages
};

int ksmget(char* name, uint size);
int ksmattach(int hd, int flag);
int ksmdetach(int hd);
int ksminfo(int hd, struct ksminfo_t* info);
int ksmdelete(int hd);

以下是我得到的错误:

> ksm.h:18: error: ‘struct ksminfo_t’ declared inside parameter list
> ksm.h:18: error: its scope is only this definition or declaration, which is prob
4

2 回答 2

5

错字,应该是struct ksm_info_t,不是struct ksminfo_t

于 2012-11-30T15:10:25.227 回答
1

您缺少下划线:

int ksminfo(int hd, struct ksminfo_t* info);

应该

int ksminfo(int hd, struct ksm_info_t* info);
于 2012-11-30T15:11:53.200 回答