PRB: C2085 Error May Be Caused by Missing SemicolonLast reviewed: July 31, 1997Article ID: Q32776 |
6.00 6.00a 6.00ax 7.00 | 6.00 6.00a | 1.00 1.50 | 1.00
MS-DOS | OS/2 | WINDOWS | WINDOWS NTkbtool kbfasttip kbprb The information in this article applies to:
SYMPTOMSAn attempt to compile an application may fail and the compiler may generate the following message:
C2085 'identifier': not in formal parameter list CAUSEThis error often indicates that a semicolon (;) is missing from the end of a function prototype.
RESOLUTIONVerify that every function prototype ends with a semicolon. Microsoft C/C++ version 8.0 for Windows NT, which is included with Visual C++ version 1.0 for Windows NT, generates the following more descriptive message:
C2444 : 'myfunc' : used ANSI prototype, found 'type' expected '{' or ';'Microsoft C/C++ version 8.00c for MS-DOS, which is included with Visual C++ version 1.5 for Windows, gives a different error message which is also more descriptive:
C2240: unexpected 'void ' following formal list (only modifiers are allowed) MORE INFORMATIONThe following code sample demonstrates this error:
Sample Code
void myfunc(void) void main(void){ } Compiling this cause produces the following messages:
error C2085: 'main' : not in formal parameter list error C2143: syntax error : missing ';' before '{'The C2085 error generally indicates that the listed parameter corresponds to a formal parameter not listed in the function definition, but the error is misleading in this case. Because no semicolon terminates the prototype, the compiler interprets the prototype as the first line of a function definition and interprets the next line as the first declaration in a function definition.
|
Additional reference words: 1.00 1.50 6.00 6.00a 6.00ax 7.00 8.00 8.00c
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |