[OTR-dev] Self-referencing structure

Twan Fox twanfox at gmail.com
Thu Apr 13 14:57:51 EDT 2006


While I understand that most don't work with Visual Studio .Net, I am 
running into a problem with that compiler as it relates to the Trillian 
OTR plugin I am writing. Specifically, this segment of code from the 
context.h file is giving it/me fits:

typedef struct fingerprint {
    struct fingerprint *next;          /* The next fingerprint in the 
list */
    struct fingerprint **tous;         /* A pointer to the pointer to us */
    unsigned char *fingerprint;        /* The fingerprint, or NULL */
    struct context *context;           /* The context to which we belong */
    char *trust;                       /* The trust level of the 
fingerprint */
} Fingerprint;

The error:

c:\TrillCrypt\libotr.head\libotr\src\context.h(45): error C2461: 
'fingerprint' : constructor syntax missing formal parameters

I know what the compiler is complaining of. It believes that the 
'unsigned char *fingerprint;' line is a constructor function for the 
struct 'fingerprint', but structs don't have constructor functions. I 
am, unfortunately, at a loss as to how to tell it to treat it as a 
regular C structure. I've attempted an extern "C" {} bracket around the 
included header files, but that seems to only work with functions, not 
data structures.

Any insight anyone has would be appreciated.


More information about the OTR-dev mailing list