日期:2014-05-16  浏览次数:20706 次

一个程序用到了一个源代码里面的所有结构体,该怎么办
我现在要把一个源代码(比如claridy的源代码)里面所有的结构的大小用一个程序列出来,我写了一个C程序,包含了源代码的头文件,用sizeof()把所有的结构体都用printf打印。。请问现在我该怎么编译,或者说怎么办才能不让我的C程序出错呢??

------解决方案--------------------
#include "your_header"

int main(...)
{
printf("%d\n", sizeof(struct XXX));
return 0;
}
Save the source as main.c, then compile:
cc main.c -o main