compiling errors cannot understand

R

rashmi

Hi All,
*************************************************
error: variable `hdlc_cdevsw' has initializer but incomplete type
***************************************************

This is the error that i'm getting while trying to compiling a driver
..inspite of this way of declaration being valid in gcc i'm getting this
error.

static struct cdevsw hdlc_cdevsw = {
.d_name = "hdlc_cdev",
.d_maj = CDEV_MAJOR,
.d_open = hdlc_open;
};
I'm here by providing the cdevsw structure for ur refrence .kindly let me
know why this err is occuring .
Charac device structure
struct cdevsw {
int d_version;
int d_maj;
u_int d_flags;
const char *d_name;
d_open_t *d_open;
d_fdopen_t *d_fdopen;
d_close_t *d_close;
d_read_t *d_read;
d_write_t *d_write;
d_ioctl_t *d_ioctl;
d_poll_t *d_poll;
d_mmap_t *d_mmap;
d_strategy_t *d_strategy;
dumper_t *d_dump;
d_kqfilter_t *d_kqfilter;
d_spare1_t *d_spare1;
d_spare2_t *d_spare2;

/* These fields should not be messed with by drivers */
LIST_ENTRY(cdevsw) d_list;
LIST_HEAD(, cdev) d_devs;
int d_refcount;
};


Thanks in Advance ,
RAshmi.N.S
 
S

SM Ryan

# Hi All,
# *************************************************
# error: variable `hdlc_cdevsw' has initializer but incomplete type
# ***************************************************
#
# This is the error that i'm getting while trying to compiling a driver
# .inspite of this way of declaration being valid in gcc i'm getting this
# error.
#
# static struct cdevsw hdlc_cdevsw = {
# .d_name = "hdlc_cdev",
# .d_maj = CDEV_MAJOR,
# .d_open = hdlc_open;
# };
# I'm here by providing the cdevsw structure for ur refrence .kindly let me

But you're not providing it to the compiler for its reference. If you're
defining the struct cdevsw in the same file, you must define it before the
variable declaration. If it is defined in a header, the header must be
included before. If it is inside an #if block, you must ensure the #if
is true at least once before the declaration.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top