I’m trying to compile a plain C program in MSVC 6.0 that has the following:
typedef struct _unitID {
int sock; // socket
unsigned long au; // the AU ID
} unitID;
However, the compiler raises a strange error:
error C 2085: 'unitID' not in formal parameter list
I’m not sure that I understand what the compiler is complaining about, since according to microsoft’s own page on the error this means “The identifier was declared in a function definition but not in the formal parameter list.”
Considering that the above snippet constitutes the entire header, and that there are no function in the file, how can I get this to compile successfully?
[EDIT – RESOLVED]: Due to a cascading error from a typedef declared in the including file prior to this.
Problem:
The Problem is caused by a typedef declared in the including file:
File [main.c]:
File [someheader.h]:
File [unitid.h]:
The error with the first typedef cascades all the way into unitid.h, causing the strange behaviour. Because we’re building with an older version of Glib, the typedef causes an error.
Solution
The solution was to add a platform check to handle the difference in how the two platforms deal with PIDs as can be seen in [main.c]: