473,320 Members | 1,799 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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


Nov 15 '05 #1
2 2070
"rashmi" <ns******@gmail.com> wrote in message
news:6d******************************@localhost.ta lkaboutprogramming.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
Nov 15 '05 #2
On Tue, 20 Sep 2005 17:29:22 +0400, Alexei A. Frounze wrote:
"rashmi" <ns******@gmail.com> wrote in message
news:6d******************************@localhost.ta lkaboutprogramming.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

Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
by: Thomas Matthews | last post by:
Hi, Given a structure of pointers: struct Example_Struct { unsigned char * ptr_buffer; unsigned int * ptr_numbers; }; And a function that will accept the structure:
0
by: Norm Wong | last post by:
If anyone is interested in using db2uext2 with Cygwin gcc compiler on Windows, I've modified the IBM provided sample with the attached file. There are two main modifications. The mkdir command...
11
by: Mannequin* | last post by:
Hi all, I'm working on a quick program to bring the Bible into memory from a text file. Anyway, I have three questions to ask. First, is my implementation of malloc () correct in the program to...
0
by: Kirt Loki Dankmyer | last post by:
So, I download the latest "stable" tar for perl (5.8.7) and try to compile it on the Solaris 8 (SPARC) box that I administrate. I try all sorts of different switches, but I can't get it to compile....
17
by: Calle Pettersson | last post by:
Coming from writing mostly in Java, I have trouble understanding how to declare a member without initializing it, and do that later... In Java, I would write something like public static void...
8
by: WebSnozz | last post by:
I have an application written in C that does a lot of low level stuff. It does a lot of things like casting from void*'s. I want to create a new GUI for it in either C# or MC++, but reuse the...
12
by: Mik0b0 | last post by:
Hallo. Let's say, there is a structure struct struct10{ int a1; int a2; int a3; int a4; }count={ {10,20,30,40}, {50,60,70,80}
13
by: WaterWalk | last post by:
Hello. When I consult the ISO C++ standard, I notice that in paragraph 3.6.2.1, the standard states: "Objects with static storage duration shall be zero-initialized before any other...
25
by: jbholman | last post by:
I am pretty new to C and doing my first project in C. I actually read almost the entire FAQ, but can't seem to figure out this problem. I have a structure. I have a list of these structures. ...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.