Hello all of u .. well i was trying to compile the iscsi module over ma system whn i was faced with this error .. the code segment is as under -
int
-
cnv_inet_to_string(struct sockaddr *ip_address, char *ip_string,
-
char *port_string)
-
{
-
__u8 *ptr;
-
__u32 k;
-
int i, c;
-
-
if (ip_address == NULL) {
-
i = -EINVAL;
-
} else if (ip_address->sa_family == AF_INET)
-
{
-
ptr = (__u8 *)&((struct sockaddr_in *)ip_address)->sin_addr.s_addr; //Dereferencing Pointer to incompete type
-
for (i = 0; i < 3; i++) {
-
ip_string += sprintf(ip_string, "%u.", *ptr++);
-
}
-
sprintf(ip_string, "%u", *ptr);
-
sprintf(port_string, "%u",
-
ntohs(((struct sockaddr_in *)ip_address)->sin_port));
-
i = AF_INET;
-
} else if (ip_address->sa_family == AF_INET6) {
-
ptr = (__u8 *)((struct sockaddr_in6 *)ip_address)
-
->sin6_addr.s6_addr;
-
c = '[';
-
for (i = 0; i < 8; i++ ) {
-
k = *ptr++ << 8;
-
k += *ptr++;
-
ip_string += sprintf(ip_string, "%c%x", c, k);
-
c = ':';
-
}
-
sprintf(ip_string, "]");
-
sprintf(port_string, "%u",
-
ntohs(((struct sockaddr_in6 *)ip_address)->sin6_port));
-
i = AF_INET6;
-
} else {
-
strcpy(ip_string, "Unknown protocol family");
-
i = -EPFNOSUPPORT;
-
}
-
return i;
-
}
-
So some1 plzz suggest me wat shd i do to get rid of this **** ....
3 2103
_u8 *ptr;
ptr = (__u8 *)&((struct sockaddr_in *)ip_address)->sin_addr.s_addr;
Why is this showing dereferencing pointer to incomplete type????
@shridharpandey: I split your posts from the old thread you posted your questions
in; don't hijack other threads for your question, no matter how old they are and
no matter how similar your question is to another question. Also add code tags
around your code for readability reasons. And please use proper spelling if you
want to be taken seriously.
kind regards,
Jos
ps. I added those code tags for you this time.
Banfa 9,065
Expert Mod 8TB
Also note that we don't allow swearing on this site, please read our posting guidelines.
Dereference to an incomplete type usually means that the compiler is aware that a structure of a given name exists but has no visibility of that structure of that structure. This most often happens when a structure name is forward declared and then the header the structure is defined in is accidentally not included.
For example suppose the file Example.h contains the following -
#ifndef EXAMPLE_H_INCLUDED
-
#define EXAMPLE_H_INCLUDED
-
-
struct Example {
-
int someData;
-
};
-
-
#endif
-
Then suppose a file main.c contained the following -
struct Example; // Forward declaration of struct Example
-
-
extern Example *GetExample();
-
extern void ReleaseExample(Example *ex);
-
-
int main(int argc, char *argp[])
-
{
-
Example *ex = GetExample();
-
-
ex->someData = 6;
-
-
ReleaseExample(ex);
-
-
return 0;
-
}
-
Supposing that GetExample and ReleaseExample are defined in another file somewhere you would get a 'dereferencing pointer to incomplete' type error on line 10. This would be solved by including the file with the declaration of struct Example rather than forward declaring it.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: junky_fellow |
last post by:
Can the size of pointer variables of different type may be
different on a particular architecture.
For eg.
Can the sizeof (char *) be different from sizeof(int *) or
sizeof (void *) ?
What...
|
by: junky_fellow |
last post by:
K&R say that,
It is guaranteed that 1) a pointer to an object may be converted to a
pointer to an object whose type requires less
or equally strict storage alignment and 2) back again without...
|
by: Alexei A. Frounze |
last post by:
Hi all,
I have a question regarding the gcc behavior (gcc version 3.3.4).
On the following test program it emits a warning:
#include <stdio.h>
int aInt2 = {0,1,2,4,9,16};
int aInt3 =...
|
by: Steven |
last post by:
Hello,
I get the following message during compilation:
`dereferencing pointer to incomplete type'
It stems from the compare function I use with qsort() and I am not
quite sure how to fix it....
|
by: friend.05 |
last post by:
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...
|
by: Pritam |
last post by:
line 7: error: dereferencing pointer to incomplete type
1. #include<stdio.h>
2. #include<sys/stat.h>
3. #include<stdlib.h>
4. void execname() {
5. struct task_struct *my;
6. my =...
|
by: Kufa |
last post by:
Hi,
I have nailed down a piece of code that is obviously wrong, but cannot
find what i should i do to make it ansi compliant, neither where in
the reference i should look.
Basically i m trying...
|
by: tejesh |
last post by:
I am trying to compile the following code
int backend_sm_run(struct interface_data *ctx)
{
xsup_assert((ctx != NULL), "ctx != NULL", TRUE);
xsup_assert((ctx->statemachine != NULL),...
|
by: hnshashi |
last post by:
I have written kernel(2.4) module to communicate with user application using
"Netlink Socket".
I am getting compilation error "Dereferencing pointer to incomplete type"
in kernel module for "nlh...
|
by: Anuz |
last post by:
Hi all,
While compiling a driver, I am getting this error:
error: dereferencing pointer to incomplete type
int __kc_adapter_clean(struct net_device *netdev, int *budget)
{
/*some...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |