473,418 Members | 4,547 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,418 software developers and data experts.

"dereferencing pointer to incomplete type" error while compiling on VxWorks.

3
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), "ctx->statemachine != NULL",
TRUE);

backend_sm_check_globals(check);

switch (ctx->statemachine->beCurState)
{
case INITIALIZE:
// We should *NEVER* get here!
backend_sm_do_initialize(ctx);
break;

case IDLE:
backend_sm_do_idle(ctx);
break;

case REQUEST:
backend_sm_do_request(ctx);
break;

case RESPONSE:
backend_sm_do_response(ctx);
break;

}

return XENONE;
}

"dereferencing pointer to incomplete type" error is thrown at lines
xsup_assert((ctx->statemachine != NULL), "ctx->statemachine != NULL",
TRUE);
and

switch (ctx->statemachine->beCurState).

interface_data structure is defined in "profile.h" which is been included.

Pls reply for any clarifications/suggestions
Mar 31 '08 #1
5 3157
Can you please include the data structure of type ctx in your post. According to my interpretation "incomplete type" means compiler know that ctx is of type struct but does not know about the members of the type struct.

Please check whether the file profile.h has actual declaration of struct ctx.
For example struct { int x; } ctx; ---> This is the actual declaration of the struct.

What I suspect is that the file profile.h just has a stuct tag defined and thats why it does not know about the members of the actual struct ctx.
For example Profile.h just has the definition of tag such as stuct xxx ctx;

If a specifier with a tag but without a list (i.e the declaration) appears when the tag is not declared, an incomplete type is returned by the compiler.
I suggest you include the declaration of struct ctx in profile.h.

I hope this helps.

Thanks.
Ambrish Kinariwala
Mar 31 '08 #2
tejesh
3
Can you please include the data structure of type ctx in your post. According to my interpretation "incomplete type" means compiler know that ctx is of type struct but does not know about the members of the type struct.

Please check whether the file profile.h has actual declaration of struct ctx.
For example struct { int x; } ctx; ---> This is the actual declaration of the struct.

What I suspect is that the file profile.h just has a stuct tag defined and thats why it does not know about the members of the actual struct ctx.
For example Profile.h just has the definition of tag such as stuct xxx ctx;

If a specifier with a tag but without a list (i.e the declaration) appears when the tag is not declared, an incomplete type is returned by the compiler.
I suggest you include the declaration of struct ctx in profile.h.

I hope this helps.

Thanks.
Ambrish Kinariwala



Thank U Ambrish for the suggestion. I had suspected the same thing but the structure elements do exist. You can have a look at the structure and pls advice.
"Profile.h" includes the following

struct dot1x_state
{
/* These variables are per the 802.1x documentation.*/
/* These are defined as constants, but don't have to be. We may want */
/* the option of changing them in the future. */
char authPeriod;
char heldPeriod;
char startPeriod;
char maxStart;

/* per 802.1x-REV-d11 section 8.2.2.1 */
char authWhile;
char aWhile;
char heldWhile;
char quietWhile;
char reAuthWhen;
char startWhen;

/* per 802.1x-REV-d11 section 8.2.2.2 */
char eapFail;
char eapolEap;
char eapSuccess;
char keyAvailable;
char keyDone;
char keyRun;
char keyTxEnabled;
char portControl;
char suppPortStatus;
char portValid;
char suppAbort;
char suppFail;
char suppStart;
char suppSuccess;
char suppTimeout;
char initialize;
char portEnabled;

/* per 802.1x-REV-d11 section 8.2.11.1.1 */
char eapRestart;
char logoffSent;
char sPortMode;
char startCount;
char userLogoff;

/* per 802.1X-REV-d11 section 8.2.12.1.1 */
char eapNoResp;
char eapReq;
char eapResp;

/* per 802.1x-REV-d11 section 8.2.3.1.1 port timers */
char tick;

/* per 802.1x-REV-d11 section 8.2.7.1.1 Key recieve */
char rxKey;

/* This isn't in the spec, but is useful.*/
char curState;
char beCurState;
char wpaCurState;
char wpaLastState;

/* This is to contain the last type of EAP packet we saw. It's only
functional purpose is to allow us to give the user some sort of error
message about what might be wrong with the connection. (i.e. If the
last EAP message we got was a Request ID, and we get a TIMEOUT, it means
we attempted to send a Response ID, and for some reason the AP ignored
us.*/
char lastEapType;

/* Keep track of the key length that is used in dynamic WEP. (Basically,
we want to know the shortest unicast and shortest broadcast keys the
AP sent.) This servers no functional purpose, but will allow us to warn
the user that some cards/drivers/APs are not happy using different length
WEP keys.*/
char unicastKeyLen;
char broadcastKeyLen;



/* This contains the number of MIC failures the driver has reported.
Once it reaches 2, we should enable countermeasures.*/
char MICfailures;

uint8_t replay_counter[8];
};

struct interface_data
{
char *intName; /* The name of this interface.*/


char source_mac[6]; /* Source MAC address.*/
char dest_mac[6]; /* Destination MAC address.*/

char *cur_essid; /* The current SSID we are using.*/

struct dot1x_state *statemachine; /* State machine info*/

uint8_t *keyingMaterial; /* Hold any keying material generated by
an EAP type. Should be NULL if there
isn't any!*/

char keyingLength; /* Normal EAP methods will return 32 bytes
of keying material. Goofy EAP methods
like LEAP use less material.*/

char *tempPassword; /* Temporary password.*/


uint8_t sendframe[1520], recvframe[1520];
int send_size, recv_size;
} ;
Mar 31 '08 #3
I would suggest to first find out where the definition of ctx is in your code base (where memory was allocated). Then try declaring that as extern at global level in your program and see the results.

It seems you may have some scope issues. Make sure that the function you're running is in the inner scope of where the ctx is actually declared in .h file. Check to see in what order it compiles the files.

I hope this helps.

Ambrish Kinariwala
Mar 31 '08 #4
tejesh
3
I would suggest to first find out where the definition of ctx is in your code base (where memory was allocated). Then try declaring that as extern at global level in your program and see the results.

It seems you may have some scope issues. Make sure that the function you're running is in the inner scope of where the ctx is actually declared in .h file. Check to see in what order it compiles the files.

I hope this helps.

Ambrish Kinariwala

Thank U Ambrish for the advice. I included "extern struct interface_data *ctx;" in the file "profile.h" as ctx was not defined anywhere.
Now there is no dereferencing error. Pls comment whether this is fine.
Apr 1 '08 #5
That should be fine. You can even include the extern declaration in the source file.

Thanks.
Ambrish Kinariwala
Apr 2 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Lou Pecora | last post by:
g++ compiler error question. I have a container C whose constructor takes a class B that is inherited from an abstract class A. So I have the line of code: B binstance; C ...
12
by: Charlie Zender | last post by:
Hi, I am unable to compile a large body of code with extremely pedantic compile time checks activate, so that warnings cause errors. With GCC 3.3.1, I do this with gcc -std=c99 -pedantic...
18
by: steve | last post by:
I'm trying to create a structure of three pointers to doubles. For which I have: typedef struct { double *lst_t, *lst_vc, *lst_ic; } last_values; I then need to allocate space for...
5
by: kj | last post by:
Hi. I'm trying to compile some software from source, and I'm getting an error I can't figure out. The error in question is key_events.h:38: field `id' has incomplete type and the lines...
0
by: hamstak | last post by:
While attempting to perform a build on an .aspx page from within VS 2005 I receive the "Could not load type" error pertaining to the class representing the page. The class is derived from a custom...
2
by: Bill_DBA | last post by:
I have the following stored procedure that is called from the source of a transformation in a DTS package. The first parameter turns on PRINT debug messages. The second, when equals 1, turns on the...
2
by: magyar.laszlo | last post by:
Hi ! I have an activex .net dll in a webpage. This activeX is trying to connect to an LDAP server using System.DirectoryServices. Unfortunatelly it gets always "request for the permission of...
20
by: chutsu | last post by:
I'm trying to compare between pointer and integer in an "IF" statement how do I make this work? if(patient.id != NULL){ } Thanks Chris
3
by: eros | last post by:
ALTER TABLE public.postcodes ALTER COLUMN machi TYPE varchar(100); Error: ERROR: syntax error at or near "TYPE"; Error while executing the query (State:42601, Native Code: 7) I am using...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.