how to extern structure?

Discussion in 'C Programming' started by dyu9999@gmail.com, Jan 15, 2005.

  1. Guest

    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
     
    , Jan 15, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Thomas Matthews
    Replies:
    5
    Views:
    2,457
    tom_usenet
    Aug 2, 2004
  2. Excluded_Middle

    Pointers to structure and array of structure.

    Excluded_Middle, Oct 24, 2004, in forum: C Programming
    Replies:
    4
    Views:
    765
    Martin Ambuhl
    Oct 26, 2004
  3. how to extern structure?

    , Jan 15, 2005, in forum: C Programming
    Replies:
    5
    Views:
    8,041
    Joe Wright
    Jan 15, 2005
  4. how to extern structure?

    , Jan 15, 2005, in forum: C Programming
    Replies:
    1
    Views:
    980
  5. Andre
    Replies:
    5
    Views:
    544
    Keith Thompson
    Jul 17, 2012
Loading...

Share This Page