PRB: Error 2065: 'jmp_buf' : Undeclared Identifier

Last reviewed: July 17, 1997
Article ID: Q86810
7.00 | 1.00 1.50 1.51 1.52 MS-DOS | WINDOWS kbtool kbprb

The information in this article applies to:

  • Microsoft C/C++ for MS-DOS, version 7.0
  • Microsoft Visual C++ for Windows, versions 1.0, 1.5, 1.51, and 1.52

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


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: July 17, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.