"The indicated type is incomplete."

This is a discussion on "The indicated type is incomplete." within the C Programming forums, part of the General Programming Boards category; I'm getting the following error: Code: cc-1070 cc: ERROR File = ./charproc.c, Line = 4841 The indicated type is incomplete. ...

  1. #1
    Registered User
    Join Date
    Jun 2004
    Posts
    10

    "The indicated type is incomplete."

    I'm getting the following error:


    Code:
    cc-1070 cc: ERROR File = ./charproc.c, Line = 4841
      The indicated type is incomplete.
    
          static XtResource fake_resources[] =
                            ^
    What does that mean?

  2. #2
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Lets see more of the source code. Especially XtResource and the entire line its refering to.

  3. #3
    Registered User
    Join Date
    Jun 2004
    Posts
    10
    This is xterm on IRIX 6.5.23.

    Code:
    static void
    VTInitialize(Widget wrequest,
    	     Widget new_arg,
    	     ArgList args GCC_UNUSED,
    	     Cardinal * num_args GCC_UNUSED)
    {
        XtermWidget request = (XtermWidget) wrequest;
        XtermWidget wnew = (XtermWidget) new_arg;
        Widget my_parent = SHELL_OF(wnew);
        int i;
        char *s;
    
    #if OPT_ISO_COLORS
        Boolean color_ok;
    #endif
    
    #if OPT_COLOR_RES2 && (MAXCOLORS > MIN_ANSI_COLORS)
        static XtResource fake_resources[] =
        {
    #if OPT_256_COLORS
    # include <256colres.h>
    #elif OPT_88_COLORS
    # include <88colres.h>
    #endif
        };
    #endif /* OPT_COLOR_RES2 */
    .
    .
    .
    The above compile error only occurs if neither OPT_256_COLORS or OPT_88_COLORS are defined, resulting in an empty array. If either of those are defined, it compiles fine.

    The other build error is this (the end curly-brace of the array):

    Code:
    cc-1029 cc: ERROR File = ./charproc.c, Line = 4848
      An expression is expected at this point.
    
          };
          ^
    Thanks for the help.

  4. #4
    Registered User
    Join Date
    Jun 2004
    Posts
    10
    Here's the XtResource definition:

    Code:
    typedef struct _XtResource {
        String	resource_name;	 
        String	resource_class;	 
        String	resource_type;	 
        Cardinal	resource_size;	 
        Cardinal	resource_offset; 
        String	default_type;	 
        XtPointer	default_addr;	 
    } XtResource, *XtResourceList;
    I gather from this that it's creating a datatype called _XtResource, then creating an instance of that type called XtResource. But then the code in my previous post is creating an array of the same type as that instance (XtResource)? Or an array of instances of XtResource?

    I'm having a little trouble figuring out what it's doing (I'm rather new to C, just trying to figure out what's happening in these programs).

    Thanks again.

  5. #5
    Obsessed with C chrismiceli's Avatar
    Join Date
    Jan 2003
    Posts
    501
    You are making an array of structs, so if you take out the preprocessors, and go the last if statement, the code would look like this after being parsed.
    Code:
    static XtResource fake_resources[] =
        {  };
    That is fine if it wasn't going to be an array of fake_resources, so you need to tell the compiler how many are going to be in that array, like this
    Code:
    static XtResource fake_resources[] = {
        { },
        { },
        { }
    };
    /* or this */
    static XtResource fake_resources[5];
    Try to work it in with your preprocessors.
    Help populate a c/c++ help irc channel
    server: irc://irc.efnet.net
    channel: #c

  6. #6
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    The above compile error only occurs if neither OPT_256_COLORS or OPT_88_COLORS are defined, resulting in an empty array. If either of those are defined, it compiles fine.
    Duh, what did you expect? You're saying "Hey, make an array containing these files. Oh, but if they're not defined, well, then don't put anything in the array, which has no determined size."
    Code:
    static XtResource fake_resources[] =
    {
    #if OPT_256_COLORS
    # include <256colres.h>
    #elif OPT_88_COLORS
    # include <88colres.h>
    #endif
    };
    How about putting a final "#else" right before the "#endif", and providing a default blank array?
    Code:
    #else
    { 0, 0, 0, 0, 0, ... }
    Quzah.
    Hope is the first step on the road to disappointment.

  7. #7
    Registered User
    Join Date
    Jun 2004
    Posts
    10
    Thanks for your replies. Again, this isn't my code, I'm just trying to figure out what it was doing. It seemed strange to me that an unsized array could go without anything in it, but it seemed even stranger than this wouldn't get caught by anyone but me.

    Anyway, I fixed it with another preprocessor statement elsewhere that got around the whole fake_resources[] thing to begin with.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 0
    Last Post: 03-20-2008, 07:59 AM
  2. Little Array Difficulty
    By G4B3 in forum C Programming
    Replies: 16
    Last Post: 03-19-2008, 12:59 AM
  3. Replies: 28
    Last Post: 07-16-2006, 11:35 PM
  4. Errors
    By Rhidian in forum C Programming
    Replies: 10
    Last Post: 04-04-2005, 12:22 PM
  5. gcc problem
    By bjdea1 in forum Linux Programming
    Replies: 13
    Last Post: 04-29-2002, 06:51 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21