compilation error: request for member in something not a structure or union

前端 未结 2 961
清歌不尽
清歌不尽 2021-01-18 02:05

Edit: The code below has been modified to work as the problem has been solved.

Specifically, (*hardwareList.next_item)->next

相关标签:
2条回答
  • 2021-01-18 02:31

    My guess the problem is this piece of code: *(hardwareList.next_item)->data

    next_item is a pointer to a pointer, so my guess is that the compiler reads this as *((hardwareList.next_item)->data) which of course doesn't work - pointers don't have any members in C.

    Try ((*(hardwareList.next_item))->data) to get the correct dereference order.

    0 讨论(0)
  • 2021-01-18 02:47

    hardwareList.next_item is HardwareListItem**, so operator -> on it returns HardwareListItem*, which obviously is not a struct.

    You're using too many pointers, it is confusing. Try to simplify your code, you have tons of bugs there.

    0 讨论(0)
提交回复
热议问题