LinuxSir.cn,穿越时空的Linuxsir!

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

奇怪的error:storage size of 问题,求指点

[复制链接]
发表于 2010-11-7 00:04:26 | 显示全部楼层 |阅读模式
meet a strange problem when am writting , 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;



thanks,
 楼主| 发表于 2010-11-7 00:08:55 | 显示全部楼层
不好意思,忘了补充一点, 用的是freebsd5.2.
回复 支持 反对

使用道具 举报

发表于 2010-11-8 10:45:04 | 显示全部楼层
楼主英文好棒
我猜是不是编译器找到了/usr/include/sys/proc.h
回复 支持 反对

使用道具 举报

 楼主| 发表于 2010-12-6 10:35:42 | 显示全部楼层
Post by x11;2118949
楼主英文好棒
我猜是不是编译器找到了/usr/include/sys/proc.h


谢谢你的回复,可能是这个问题吧,谢谢,后来我在用户区又重新定义了一遍
回复 支持 反对

使用道具 举报

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

本版积分规则

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