Unclear Error Messages

This is a discussion on Unclear Error Messages within the C Programming forums, part of the General Programming Boards category; I am compiling a third-party code on my Windows machine using Cygwin. Essentially this is a virtual unix machine running ...

  1. #1
    Registered User
    Join Date
    Oct 2012
    Posts
    1

    Unclear Error Messages

    I am compiling a third-party code on my Windows machine using Cygwin. Essentially this is a virtual unix machine running on my Windows desktop.

    During the compile I receive the following errors:

    /usr/include/X11/extensions/shapeproto.h:51:2: error: expected specifier-qualifier-list before ‘CARD8’
    /usr/include/X11/extensions/shapeproto.h:58:2: error: expected specifier-qualifier-list before ‘BYTE’

    These errors refer to lines in a header file where a data structure is defined. The offending data structure is:

    Code:
    typedef struct _ShapeQueryVersion {
            CARD8   reqType;                /* always ShapeReqCode */
            CARD8   shapeReqType;           /* always X_ShapeQueryVersion */
            CARD16  length B16;
    } xShapeQueryVersionReq;
    Note that regType makes the compiler (gcc) queasy, but the following line does not. This declaration is akin to the other error on line 58 for another data structure definition:

    Code:
    typedef struct {
            BYTE    type;                   /* X_Reply */
            CARD8   unused;                 /* not used */
            CARD16  sequenceNumber B16;
            CARD32  length B32;
            CARD16  majorVersion B16;       /* major version of SHAPE protocol */
            CARD16  minorVersion B16;       /* minor version of SHAPE protocol */
            CARD32  pad0 B32;
            CARD32  pad1 B32;
            CARD32  pad2 B32;
            CARD32  pad3 B32;
            CARD32  pad4 B32;
    } xShapeQueryVersionReply;
    I do not know what a CARD8 means as a variable type, so I am confused as to what the compiler is complaining about. I am also a FORTRAN programmer who can muddle through C code, but does not regularly code in it.

    Thanks for any help you can give.

  2. #2
    - - - - - - - - oogabooga's Avatar
    Join Date
    Jan 2008
    Posts
    2,808
    CARD8, etc., seem to be defined in <X11/Xmd.h>.
    Try adding
    Code:
    #include <X11/Xmd.h>
    to the top shapeproto.h.
    The cost of software maintenance increases with the square of the programmer's creativity. - Robert D. Bliss

  3. #3
    Registered User
    Join Date
    Jun 2005
    Posts
    6,307
    Quote Originally Posted by mzottola View Post
    Note that regType makes the compiler (gcc) queasy, but the following line does not.
    gcc (like some other compilers) is smart smart enough that, if a program exhibits multiple problems of the same kind, it only complains about the first occurrence.

    Quote Originally Posted by mzottola View Post
    I do not know what a CARD8 means as a variable type, so I am confused as to what the compiler is complaining about.
    The error message on line 51 is the compiler's way of telling you it doesn't know what CARD8 is either. There is presumably some other header file somewhere that defines CARD8 as a type. Where that file is, I don't know - it is presumably somewhere relevant to the "third party" code.

    Quote Originally Posted by mzottola View Post
    I am also a FORTRAN programmer who can muddle through C code, but does not regularly code in it.
    Imagine, in Fortran, you had added a line "IMPLICIT NONE" to all your functions, and then later used a variable without specifying its type. The complaints you would get from a Fortran compiler are akin to the problems the C compiler is complaining about here.

    Unlike Fortran, C requires all variables to be explicitly given a type, by default.
    Right 98% of the time, and don't care about the other 3%.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help with error messages
    By ashleyd in forum C++ Programming
    Replies: 2
    Last Post: 10-30-2011, 12:59 PM
  2. Replies: 5
    Last Post: 10-02-2011, 03:21 PM
  3. unclear about typecasting and creating pointers
    By kirani in forum C Programming
    Replies: 11
    Last Post: 06-16-2010, 04:29 PM
  4. Help with error messages
    By chris1985 in forum Windows Programming
    Replies: 1
    Last Post: 01-11-2005, 02:39 PM
  5. Different error messages...
    By EvBladeRunnervE in forum Networking/Device Communication
    Replies: 2
    Last Post: 03-29-2004, 07:01 PM

Tags for this Thread


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