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