Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > how to extern structure?

Reply
Thread Tools

how to extern structure?

 
 
dyu9999@gmail.com
Guest
Posts: n/a
 
      01-15-2005
Hi,

I have a following error and would appreciate any help.

================================================== ======

* in foo.c I have

typedef struct _my_data_t {
int a;
int b;
} my_data_t;

* in foo.h, I have

typede struct _my_data_t my_data_t;

* in foo2.c, I have

#include "foo.h"

int value = some_func(((my_data_t *)x)->a);

gcc complains "dereferencing pointer to incomplete type"

What didI do wrong here ? Is it correct to to definition in foo.h ?
Thanks

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Difference of extern short *x and extern short x[]? Andre C Programming 5 07-17-2012 07:38 PM
extern const char * vs. extern const char []http://tinyurl.com/47e3k Thomas Matthews C++ 5 08-02-2004 10:36 AM
Re: extern function declaration josef angermeier C++ 0 07-17-2003 08:31 AM
char s[] = "asdf" and extern char *s in separate files Newsgroup - Ann C++ 1 07-05-2003 06:34 AM



Advertisments