2011年5月9日 星期一

error: dereferencing pointer to incomplete type

I got following error:

debug.c: In function '_get_pid':
debug.c:6: error: dereferencing pointer to incomplete type

while compiling module on 2.6.35 contain following code:
static inline pid_t *_get_pid(void)
{
return current->pid;
}


The same module has no issue on 2.6.31.

Strange error(dereferencing pointer to incomplete type)
http://stackoverflow.com/questions/2693393/strange-errordereferencing-pointer-to-incomplete-type
The solution is to include both of these headers:
#include <linux/sched.h>
#include <linux/fs_struct.h>

沒有留言: