开发者

Struct declaration error in C

开发者 https://www.devze.com 2022-12-31 04:55 出处:网络
ive got a struct problem it returns: cd.h:15: error: two or more data types in declaration specifiers its probably something simple ...

ive got a struct problem it returns:

cd.h:15: error: two or more data types in declaration specifiers

its probably something simple ...

  struct cd {
        char titel[32];
        char artiest[32];
        int speelduur;  

    };

    typedef struct cd CD;
    struct cdlijst{ 
        CD *item;
        struct cdlijst *next;
    }


   开发者_如何转开发 typedef struct cdlijst CDLijst;


Perhaps you need a semicolon after the second struct declaration, like this:

struct cdlijst{ 
    CD *item;
    struct cdlijst *next;
};


Some otherwise incomprehensible error messages (including this one) are due to things as simple as missing semicolons.


The answer is that you missed a semi-colon at the end of declaration of struct cdlijst, add a semi-colon will fixes the problem.

By the way, I would like to recommand Clang for syntax correcting, since it will give much better explanations on compiling errors. Here is an article comparing gcc and Clang on error recovery messages: http://blog.llvm.org/2010/04/amazing-feats-of-clang-error-recovery.html.

0

精彩评论

暂无评论...
验证码 换一张
取 消