compiling errors cannot understand #2

  • Follow


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




0
Reply nsrashmi (17) 9/20/2005 1:06:54 PM

"rashmi" <nsrashmi@gmail.com> wrote:
# 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.

--
SM Ryan http://www.rawbw.com/~wyrmwif/
Title does not dictate behaviour.
0
Reply wyrmwif (945) 9/20/2005 2:14:23 PM


1 Replies
38 Views

(page loaded in 0.033 seconds)


Reply: