error: dereferencing pointer to incomplete type ‘struct task_struct’


/usr/src/linux-headers-4.9.0-3-common/arch/x86/include/asm/uaccess.h:33:26: error: dereferencing pointer to incomplete type ‘struct task_struct’
 #define get_fs() (current->thread.addr_limit)

 

出错原因主要在current上,宏current定义在arch/.../include/asm/current.h中。编译器不知道task_struct的具体定义,因此,无法解引用current,无法获知其成员pid、comm、flags的类型,才报“dereferencing pointer to incomplete type” task_struct定义在<linux/sched.h>中。在源文件头,加上#include <linux/sched.h>,即可解决问题!

“dereferencing pointer to incomplete type”错误,大多也是因为不知道struct/class/emun/union等的定义而引起的。
 
原文链接:https://blog.csdn.net/zbqwxy/article/details/8697896


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM