Microsoft KB Archive/42019

= PRB: Missing Closing &quot;)&quot; in Macro Causes Unexpected EOF =

Article ID: 42019

Article Last Modified on 7/5/2005

-

APPLIES TO


 * Microsoft Visual C++ 1.0 Professional Edition
 * Microsoft Visual C++ 1.5 Professional Edition
 * Microsoft Visual C++ 1.0 Professional Edition
 * Microsoft Visual C++ 2.0 Professional Edition
 * Microsoft Visual C++ 4.0 Standard Edition
 * Microsoft Visual C++ 5.0 Standard Edition
 * Microsoft Visual C++ 6.0 Service Pack 5

-



This article was previously published under Q42019





SUMMARY
The compiler generates one of the following errors:

C1057 unexpected EOF in macro expansion ( missing ')'? )

-or-

fatal error C1057: unexpected end of file in macro expansion

This behavior is by design. It informs the user of a syntax error. Examine the code line indicated by the compiler error. Ensure that the macro is used properly with both opening and closing parentheses and all parameters required.

Sample Code
The following sample code generates the error: /* Compile options needed: none


 * 1) include 
 * 2) define add(wx, wy) (wx) + (wy)

void main {  int i;   i = add( 1, 2 ); printf( &quot;i = %d\n&quot;, i );

i = add( 1, 2 ;            /* missing ')' */

printf( &quot;Hello World\n&quot; ); for( i = 0; i < 10; i++ ) {     printf( &quot;i + 10 = %d\n&quot;, add( i, 10 ) ); } }

Additional query words: 8.00 8.00c 9.00

Keywords: kbprb KB42019

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.