I have a struct abc in one file
struct abc {
some variaables
and functions
}
I am using this struct in other file as follows :
struct abc *t = kmalloc(sizeof(struct abc));
kmalloc is equivalent to malloc
then following errors occur:
expected '=', ',', ';', 'asm' or '__attribute__' before 'struct'
error: variable 't' has initializer but incomplete type
warning: implicit declaration of function 'kmalloc'
invalid application of 'sizeof' to incomplete type 'struct trapframe'
storage size of 't' isn't known
where am I going wrong?
1, 2, 4 and 5 errors are caused by missing ;
at the end of your struct declaration. It must be:
struct abc {
some variaables
and functions
};
3 error is caused by missing the including of include/linux/slab.h
file. You have to add the below file at the head of your source code file:
#include < linux/slab.h>
# please remove the space before "linux"