PRB: C2060 or C1004 Error Occurs Using TRY/CATCH MacrosLast reviewed: August 8, 1997Article ID: Q93447 |
The information in this article applies to:
SYMPTOMSWhen compiling a C++ program that uses the TRY and CATCH macros to implement exception handling, the compilation fails with the following error message:
error C2060: syntax error : end-of-file foundWith Visual C++ 32-bit Edition, the following error is generated:
fatal error C1004: unexpected end of file found CAUSEA CATCH (or AND_CATCH) block is not closed with the END_CATCH macro. The CATCH macro creates a code block that is to be terminated by the END_CATCH macro.
RESOLUTIONModify the program code to add the END_CATCH macro to the exception handling code.
MORE INFORMATION
Sample Code
/* Compile option needed: none if source file given .cpp extension,
/Tp otherwise.
*/
#include <afx.h>
#include <afxwin.h>
void main(void)
{
TRY
{
}
CATCH(CFileException,e)
{
}
// Uncomment following line for successful compilation
//END_CATCH
}
|
Additional query words: 8.00 8.00c 9.00 9.10
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |