lib/libsolkerncompat/vfs.c:291:27: error: expected expression before 'vfsops_t'
list_entry(pos,struct _MAC_DATA,list);
编译时出现如下错误:
error: expected expression before 'struct'
原因是:
#define list_entry(ptr, type, member) ({ \
const typeof( ((type *)0)->member ) *__mptr = (ptr);\
(type *)( (char *)__mptr - offsetof(type,member) );\
})
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
此宏没有定义导致list_entry()调用失败!
解决方法:
包含头文件"unistd.h"即可。
其实真正声明offsetof()是在stddef.h头文件中。所以最好的方法是直接包含此头文件。
来自 http://blog.chinaunix.net/uid-28253945-id-3405862.html
lib/libsolkerncompat/vnode.c:95:25: error: expected expression before 'struct'
编译一个应用程序,报以下错误:
[root@localhost 3250RTC]# make
gcc -o 3250rtc 3250rtc.c
3250rtc.c: In function ‘update_rtc’:
3250rtc.c:47: error: expected expression before ‘struct’
make: *** [3250rtc] Error 1
解决办法:
#include <sys/ioctl.h>
#include <stddef.h>
fatal error: attr/xattr.h: No such file or
Fun, my setxattr man pages says you should include attr/xattr.h, and both attr/xattr.h and sys/xattr.h exist on my system. Attr version belongs to libattr1-dev and sys version belongs to libc6-dev.
https://github.com/pmem/pmemfile/issues/252
网友评论