PRB: Error 2065: 'jmp_buf' : Undeclared Identifier

ID: Q86810

7.00 | 1.00 1.50 1.51 1.52 MS-DOS | WINDOWS kbtool kbprb

The information in this article applies to:

SYMPTOMS

When compiling a C++ program that uses the setjmp and longjmp functions with Microsoft C++, the following errors may be generated:

   error C2065: 'jmp_buf' : undeclared identifier
   error C2065: 'setjmp' : undeclared identifier
   error C2065: 'longjmp' : undeclared identifier
   error C2064: term does not evaluate to a function

CAUSE

The setjmp, longjmp, and jmp_buf identifiers are declared in the SETJMP.H header file. These declarations are not included if the __cplusplus symbol is defined.

MORE INFORMATION

The symbol __cplusplus is defined when a C++ program is compiled. Because setjmp and longjmp are not supported in C++ programs, the declarations are nested in an #ifndef block, which causes the declarations to be skipped if the __cplusplus symbol is defined.

Although setjmp and longjmp can be used in a C++ program, their use is discouraged. If a jump takes your program out of the function block in which a class was declared, the destructors for the classes will not be called. This will have deleterious effects.

Additional reference words: 1.00 1.50 7.00 8.00 8.00c setjmp longjmp jmp_buf KBCategory: kbtool kbprb KBSubcategory: CPPIss Keywords : kb16bitonly

Last Reviewed: July 18, 1997