Extern - dereferencing pointer to incomplete type. | | |
I have three files.
graph.h:
My header file where I have typedef for my structure and function
delcaration
typedef struct _ipc_actors ipc_graph_actors;
typedef ipc_graph_type *ipc_graph_pointer;
ipc_graph_pointer ipc_graph_new(graph_pointer,char *, char *, char *,
char *, char *);
graph.c:
My funciton is implemented in this file. And also my sturcture defition
are in this file.
main.c:
Here I am calling my fuction ipc_graph_new(graph_pointer,char *, char
*, char *, char *, char *);
This return a one pointer which is pointer to struture which I have
define din graph.c
But when I try to use this pointer to access the attributes of this
structure it gives me following error:
dereferencing pointer to incomplete type.
I think I have to use extern somewhere, but I am not sure. | | | | re: Extern - dereferencing pointer to incomplete type.
friend.05 wrote:
You don't have to ask twice. Quote:
I have three files.
>
>
graph.h:
>
My header file where I have typedef for my structure and function
delcaration
>
typedef struct _ipc_actors ipc_graph_actors;
typedef ipc_graph_type *ipc_graph_pointer;
>
ipc_graph_pointer ipc_graph_new(graph_pointer,char *, char *, char *,
char *, char *);
>
graph.c:
>
>
My funciton is implemented in this file. And also my sturcture defition
are in this file.
>
main.c:
>
Here I am calling my fuction ipc_graph_new(graph_pointer,char *, char
*, char *, char *, char *);
>
This return a one pointer which is pointer to struture which I have
define din graph.c
>
But when I try to use this pointer to access the attributes of this
structure it gives me following error:
>
dereferencing pointer to incomplete type.
>
I think I have to use extern somewhere, but I am not sure.
>
No, the definition of the struct has to be visible to the compiler if
you wish to access its members.
Put the definition in the common header.
--
Ian Collins. | | | | re: Extern - dereferencing pointer to incomplete type.
Hai ian ,
What u said is correct that compiler has to see the definition of the
structure and it has to be placed in common headerfile, but in a good
design of the projects it is said to have the definitions of
datastructures in a c file and their declarations in relevent header
files. isnt there any way to make code error free this way?
Regards,
Vamshi.
On Nov 22, 12:04 pm, Ian Collins <ian-n...@hotmail.comwrote: Quote:
friend.05 wrote:You don't have to ask twice.
>
>
> Quote:
I have three files.
> > Quote:
My header file where I have typedef for my structure and function
delcaration
> Quote:
typedef struct _ipc_actors ipc_graph_actors;
typedef ipc_graph_type *ipc_graph_pointer;
> Quote:
ipc_graph_pointer ipc_graph_new(graph_pointer,char *, char *, char *,
char *, char *);
> > Quote:
My funciton is implemented in this file. And also my sturcture defition
are in this file.
> > Quote:
Here I am calling my fuction ipc_graph_new(graph_pointer,char *, char
*, char *, char *, char *);
> Quote:
This return a one pointer which is pointer to struture which I have
define din graph.c
> Quote:
But when I try to use this pointer to access the attributes of this
structure it gives me following error:
> Quote:
dereferencing pointer to incomplete type.
> Quote:
I think I have to use extern somewhere, but I am not sure.No, the definition of the struct has to be visible to the compiler if
you wish to access its members.
>
Put the definition in the common header.
>
--
Ian Collins.
| | | | re: Extern - dereferencing pointer to incomplete type.
vamshi wrote:
Please don't top post. Quote:
>
On Nov 22, 12:04 pm, Ian Collins <ian-n...@hotmail.comwrote:
> Quote:
>>friend.05 wrote:You don't have to ask twice.
>> Quote:
>>>But when I try to use this pointer to access the attributes of this
>>>structure it gives me following error:
>> Quote:
>>>dereferencing pointer to incomplete type.
>> Quote:
>>>I think I have to use extern somewhere, but I am not sure.No, the definition of the struct has to be visible to the compiler if
>>
>>you wish to access its members.
>>
>>Put the definition in the common header.
>>
Hai ian ,
What u said is correct that compiler has to see the definition of the
structure and it has to be placed in common headerfile, but in a good
design of the projects it is said to have the definitions of
datastructures in a c file and their declarations in relevent header
files. isnt there any way to make code error free this way?
>
Who's u?
If you want to use an opaque type to hide the structure definition, you
gave to provide accessor functions (which take a pointer to the
structure as a parameter) to access the structure members.
--
Ian Collins. | | | | re: Extern - dereferencing pointer to incomplete type.
vamshi wrote: Quote:
>
What u said is correct that compiler has to see the definition of
the structure and it has to be placed in common headerfile, but in
a good design of the projects it is said to have the definitions
of datastructures in a c file and their declarations in relevent
header files. isnt there any way to make code error free this way?
Rude top-posting ignored. Also offensive use of silly
abbreviations.
--
A: Because it fouls the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail? | | | | re: Extern - dereferencing pointer to incomplete type.
Yes i need to keep structure definition opaque.
So wht midification I have to do so that I do not get an error.
On Nov 22, 5:48 am, CBFalconer <cbfalco...@yahoo.comwrote: Quote:
vamshi wrote:
> Quote:
What u said is correct that compiler has to see the definition of
the structure and it has to be placed in common headerfile, but in
a good design of the projects it is said to have the definitions
of datastructures in a c file and their declarations in relevent
header files. isnt there any way to make code error free this way?Rude top-posting ignored. Also offensive use of silly
abbreviations.
>
--
A: Because it fouls the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
| | | | re: Extern - dereferencing pointer to incomplete type.
friend.05 wrote: Quote:
Yes i need to keep structure definition opaque.
>
So wht midification I have to do so that I do not get an error.
>
>
>
>
>
On Nov 22, 5:48 am, CBFalconer <cbfalco...@yahoo.comwrote: Quote:
vamshi wrote: Quote:
What u said is correct that compiler has to see the definition of
the structure and it has to be placed in common headerfile, but in
a good design of the projects it is said to have the definitions
of datastructures in a c file and their declarations in relevent
header files. isnt there any way to make code error free this way?Rude top-posting ignored. Also offensive use of silly
abbreviations.
--
A: Because it fouls the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Why do you think it is a good idea to reply to a message complaining
about top-posting and silly abbreviations by using more silly
abbreviations, messing up the quoting, leaving in the signature (again
complaining about top-posting!) and replying top-posted to a message
you're not even commenting on? | | | | re: Extern - dereferencing pointer to incomplete type.
"friend.05" wrote: Quote:
>
Yes i need to keep structure definition opaque.
>
So wht midification I have to do so that I do not get an error.
Don't top-post. Your reply belongs after, or intermixed with, the
material to which you reply. See the links below.
--
Some informative links:
<news:news.announce.newusers
<http://www.geocities.com/nnqweb/>
<http://www.catb.org/~esr/faqs/smart-questions.html>
<http://www.caliburn.nl/topposting.html>
<http://www.netmeister.org/news/learn2quote.html>
<http://cfaj.freeshell.org/google/> | | | | re: Extern - dereferencing pointer to incomplete type.
friend.05 wrote: Quote:
Yes i need to keep structure definition opaque.
>
So wht midification I have to do so that I do not get an error.
Why're you consistently ignoring the posting and quoting advice being
given? If you persist you may find that you're ignored by a lot of
regulars, thus missing out on their possible contribution to your
questions.
Also please post under a single name. Morphing stinks of trolling. |  | | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,501 network members.
|