LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1663|回复: 0

error:storage size of 'XX' isn't known

[复制链接]
发表于 2010-11-7 00:14:44 | 显示全部楼层 |阅读模式
I am trying to modify some part of kernel, here I meet a problem. the struct that I defined in /sys/sys/proc.h can not be used , but struct proc could be used.

For example:

In file---------- ----/sys/sys/proc.h

struct proc /* old proc struct in proc.h*/
{ ... };
struct fox_test
{ int a; } ; /**my new defined struct */

In ------------------------/tmp/test.c

#include<fcntl.h>
#include<sys/param.h>
#include<sys/proc.h>

struct proc ppc;

//struct fox_test ftt;
/*
//if I add this line above("struct fox_test ftt;"), this file will fall in compile; error:storage size of 'ftt' isn't known
// however , this file could be compiled successfully without "struct fox_test ftt;"
*/
int main()
{
return 0;
}

>cc ./test.c
>error:storage size of 'ftt' isn't known


I even try to test this problem in /usr/src/bin/ps
I can define "struct proc ppc;" in ps.c , then I usd make command. It compiles correct.
But when I add "struct fox_test ftt; " ,then I usd make command. It fails with the same error;

简单的说 ,就是在sys/sys/proc.h中点添加自己的结构体fox_test.可是在.c文件中包含了头文件proc.h也不能定义fox_test类型的变量,错误信息是error:storage size of 'XXXX' isn't known
可是同在proc.h中的proc就可以使用。

thanks,
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表