Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试编译多播侦听器,但 gcc 在struct ip_mreq mreq声明中发现错误。错误是"storage size of 'mreq' isn't known"我应该怎么做?
struct ip_mreq mreq
"storage size of 'mreq' isn't known"
确保您的程序包含<netinet/in.h>,或在您的系统中定义的任何位置。此外,某些系统要求以特定顺序包含头文件。因此,根据报告错误的位置,您可能需要更改头文件包含的顺序以确保满足依赖关系。
<netinet/in.h>
我有同样的问题(是的,我包括在内<netinet/in.h>)。添加
#ifndef _GNU_SOURCE #define _GNU_SOURCE #endif
在我的 .c 文件顶部解决了这个问题。