expected ‘struct matrix_t *’ but argument is of type ‘struct matrix_t *’ ?_? no difference

后端 未结 3 1854
北荒
北荒 2021-01-19 09:11
main.c:78:25: erreur: assignment from incompatible pointer type [-Werror]
main.c:81:9: erreur: passing argument 2 of ‘matrix_multiply’ from incompatible pointer type         


        
3条回答
  •  再見小時候
    2021-01-19 09:53

    Aha, you don't have a struct matrix_t yet the next field is declared using a struct tag. This then causes problems whenever the next field is used.

    matrix_t could be both a struct tag and a type name, as they are in different namespaces, but as it is, your definition starts with...

    struct {
    

    not...

    struct matrix_t {
    

    In other words, you have an unnamed struct which has a typedef called matrix_t but you never actually define a struct matrix_t.

提交回复
热议问题