Design declaration error in C

I have a problem with the structure it returns:

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

maybe 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;
+3
source share
3 answers

You may need a semicolon after the second structure declaration, for example:

struct cdlijst{ 
    CD *item;
    struct cdlijst *next;
};
+5
source

Some obscure error messages (including this one) are as simple as semicolons.

+3
source

, struct cdlijst, , .

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

+3
source

Source: https://habr.com/ru/post/1746854/


All Articles