|
|
compiling errors while initializing a structure has function pointers as members
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.
I have declared hdlc_open and defined CDEV_MAJOR prior to this .
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;
};
kindly let me know what is the problem here
Thanks in Advance ,
RAshmi.N.S
|
|
0
|
|
|
|
Reply
|
nsrashmi (17)
|
9/20/2005 1:12:19 PM |
|
"rashmi" <nsrashmi@gmail.com> wrote in message
news:6d25cdf9d90b8abac460089947c78336@localhost.talkaboutprogramming.com...
> 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.
> I have declared hdlc_open and defined CDEV_MAJOR prior to this .
> static struct cdevsw hdlc_cdevsw = {
> .d_name = "hdlc_cdev",
^^^ dots aren't part of the name, they have special use -- when accessing
member of a structure but not when defining/declaring it. Remove the dots
here.
Alex
|
|
0
|
|
|
|
Reply
|
alexfru (352)
|
9/20/2005 1:29:22 PM
|
|
On Tue, 20 Sep 2005 17:29:22 +0400, Alexei A. Frounze wrote:
> "rashmi" <nsrashmi@gmail.com> wrote in message
> news:6d25cdf9d90b8abac460089947c78336@localhost.talkaboutprogramming.com...
>> 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.
>> I have declared hdlc_open and defined CDEV_MAJOR prior to this .
The error is saying that the structure type is incomplete i.e. the
compiler cannot see a definition (i.e. the specification of the
structure members) of struct cdevsw at this point.
>> static struct cdevsw hdlc_cdevsw = {
>> .d_name = "hdlc_cdev",
>
> ^^^ dots aren't part of the name, they have special use -- when accessing
> member of a structure but not when defining/declaring it. Remove the dots
> here.
Dots aren't part of the name but they are part of the C99 named structure
member initialisation syntax so they are required here.
Lawrence
|
|
0
|
|
|
|
Reply
|
lknews (877)
|
9/20/2005 3:56:11 PM
|
|
|
2 Replies
36 Views
(page loaded in 0.066 seconds)
|
|
|
|
|
|
|
|
|