Search code examples
cvisual-studio-2008bonjour

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


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?


Solution

  • Instead of

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

    you should use

     typedef struct rdataNSEC rdataNSEC;
     struct rdataNSEC{ };