#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2013
    Posts
    2
    Rep Power
    0

    Global Structure and changing values


    I have two files
    File #1 has the following declaration, as global
    ------------------------------------
    struct COMP_LUT{
    unsigned char X_table[5][5];
    unsigned char Y_table[5][5];
    };

    struct COMP_LUT PIXEL_LUT; // global

    -----------------------------------

    File #2 has the following
    ------------------------------------------------
    extern struct COMP_LUT PIXEL_LUT; // global
    ....
    ...
    ...
    PIXEL_LUT.X_table[0][0] = 10; // <=== Compiler error

    ---------------------------------------------

    The line where I get the compiler error is shown above and
    it states "incomplete type is not allowed"? Any idea what is going on? Thanks for your help.
  2. #2
  3. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Location
    India
    Posts
    95
    Rep Power
    4
    you need to declare structure in both files or you can make header file and include it in both files.

    without declaration compiler doesn't know about structure member that's why you are getting such error..
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2013
    Posts
    2
    Rep Power
    0
    Thank you that helped... :)

IMN logo majestic logo threadwatch logo seochat tools logo