malloc - declare memory to struct in c -
i have struct abc in 1 file
struct abc { variaables , functions }
i using struct in other file follows : struct abc *t = kmalloc(sizeof(struct abc));
kmalloc equivalent malloc
then following errors occur:
expected '=', ',', ';', 'asm' or '__attribute__' before 'struct' error: variable 't' has initializer incomplete type warning: implicit declaration of function 'kmalloc' invalid application of 'sizeof' incomplete type 'struct trapframe' storage size of 't' isn't known
where going wrong?
1, 2, 4 , 5 errors caused missing ;
@ end of struct declaration. must be:
struct abc { variaables , functions };
3 error caused missing including of include/linux/slab.h
file. have add below file @ head of source code file:
#include < linux/slab.h>
# please remove space before "linux"
Comments
Post a Comment