error C2016: C requires that a struct or union has at least one member (while compiling Bonjour)

StackOverflow https://stackoverflow.com/questions/19590246

  •  01-07-2022
  •  | 
  •  

I've downloaded Bonjour following this answer - https://stackoverflow.com/a/19585202/492336

I'm trying to compile it for Windows, using VS2008, but I'm getting this error:

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

The error is at mDNSEmbeddedAPI.h, at this place in the code:

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

Since this is a well-known library released by Apple, I'm surprised that it would fail to compile, provided they ship it as a Visual Studio project.

Is it because I'm using VS2008? The project file originally shipped was for an older version - I think VS2005?

有帮助吗?

解决方案

Instead of

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

you should use

 typedef struct rdataNSEC rdataNSEC;
 struct rdataNSEC{ };

其他提示

From the comments just above the declaration of rdataNSEC (in mDNSEmbeddedAPI.h):

// ... The following is just a palceholder
// and never used anywhere.

So why not just comment out the declaration?

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top