这是我的头文件,它包含在另一个文件中但尚未使用:
#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
答案 0 :(得分:5)
错字,应该是struct ksm_info_t
,而不是struct ksminfo_t
。
答案 1 :(得分:1)
你缺少一个下划线:
int ksminfo(int hd, struct ksminfo_t* info);
应该是
int ksminfo(int hd, struct ksm_info_t* info);