c - 错误 C2016 : C requires that a struct or union has at least one member (while compiling Bonjour)

标签 c visual-studio-2008 bonjour

我已经按照这个答案下载了 Bonjour - https://stackoverflow.com/a/19585202/492336

我正在尝试使用 VS2008 为 Windows 编译它,但出现此错误:

error C2016: C requires that a struct or union has at least one member

错误在 mDNSEmbeddedAPI.h,在代码的这个地方:

#define NSEC_MCAST_WINDOW_SIZE 32
typedef struct
{
    //domainname *next;
    //char bitmap[32];
} rdataNSEC;

由于这是 Apple 发布的知名库,我很惊讶它无法编译,前提是他们将其作为 Visual Studio 项目发布。

是不是因为我用的是VS2008?最初发布的项目文件是针对旧版本的 - 我认为是 VS2005?

最佳答案

代替

typedef struct
{
    //domainname *next;
    //char bitmap[32];
} rdataNSEC;

你应该使用

 typedef struct rdataNSEC rdataNSEC;
 struct rdataNSEC{ };

关于c - 错误 C2016 : C requires that a struct or union has at least one member (while compiling Bonjour),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19590246/

相关文章:

c - 有没有办法为 C 中的类型分配一个唯一编号?

c - "peek"入eventfd内部计数器值不变

无法使用我的目标值检查第一个节点的值,以避免 place_first 函数中的重复

在 C 中使用数组和值调用函数是否已更改?

asp.net-mvc - 为什么 Visual Studio 无法识别我添加的新 Filter 类?

visual-studio-2008 - 带有平台工具集 v90 的 Visual Studio 2013

asp.net-mvc - 在 Visual Studio 中插入替换字符的最快方法

android - Apple 的 Bonjour 协议(protocol)是否适用于蜂窝连接?

macos - 如何找出我的多播 (Bonjour) 主机名?

android - 如何在 Android 上解析 Bonjour 域名?