field has incomplete type

This is a discussion on field has incomplete type within the C Programming forums, part of the General Programming Boards category; I am trying to port a program. The complier says 'field "pointer" has incomplete type typedef struct dc6header_s { long ...

  1. #1
    Jeff Childers
    Join Date
    Nov 2004
    Location
    Amarillo Tx
    Posts
    2

    field has incomplete type

    I am trying to port a program. The complier says 'field "pointer" has incomplete type

    typedef struct dc6header_s
    {
    long version; // 06000000
    long unknown01; // 01000000
    long unknown02; // 00000000
    byte termination[4];// EEEEEEEE or CDCDCDCD
    long unknown03; // 10000000
    long blockcount; // 10000000
    // after this, are pointers
    long pointer[]; //<------------here
    } dc6header;

    how can I fix this?

  2. #2
    Jez
    Jez is offline
    The C-er
    Join Date
    Mar 2004
    Posts
    192
    Sounds like your compiler isn't fully C99 compatible. I've done the same thing here with no trouble.

  3. #3
    Jeff Childers
    Join Date
    Nov 2004
    Location
    Amarillo Tx
    Posts
    2
    I am trying to compile it on os X do you have any suggestions it uses gcc

  4. #4
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    Specify the size of the array named pointer, eg
    >long pointer[100];
    or if you want a pointer instead of an array:
    >long *pointer;
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  5. #5
    not-a-geek
    Join Date
    Apr 2004
    Posts
    210
    Did you try this?

    Code:
    gcc -std=c99 ...
    If all else fails you could use the gcc extension Arrays of Length Zero

    Btw, your code compiles fine on GCC 3.3 even without -std=c99. Maybe older version default to a different standard.
    main() { int O[!0<<~-!0]; (!0<<!0)[O]+= ~0 +~(!0|!0<<!0); printf("a function calling "); }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how do you resolve this error?
    By -EquinoX- in forum C Programming
    Replies: 32
    Last Post: 11-05-2008, 04:35 PM
  2. Please critique and suggest improvements for parser
    By Queue in forum C Programming
    Replies: 14
    Last Post: 09-28-2006, 09:28 PM
  3. Problem with Visual C++ Object-Oriented Programming Book.
    By GameGenie in forum C++ Programming
    Replies: 9
    Last Post: 08-30-2005, 12:21 AM
  4. Please Help - Problem with Compilers
    By toonlover in forum C++ Programming
    Replies: 5
    Last Post: 07-23-2005, 11:03 AM
  5. Glib and file manipulation
    By unixOZ in forum Linux Programming
    Replies: 1
    Last Post: 03-22-2004, 09:39 PM

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