PRB: Using Old Include Files May Cause L2029

Last reviewed: July 17, 1997
Article ID: Q83869
7.00 | 1.00 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, version 1.0

SYMPTOMS

When linking a C++ program, the linker cannot find many of the C run-time routines even though the source files were successfully compiled with Microsoft C/C++ version 7.0 or Visual C++ version 1.0. LINK issues the error:

   L2029: 'symbol': unresolved external

NOTE: The symbol is a fully qualified function declaration (that is, includes its return type and parameters).

CAUSE

The include files that come with C/C++ version 7.0 and Visual C++ verison 1.0 use the following code at the beginning and end of the file to ensure proper linkage of C++ code to the C run-time library, whose modules are written in C:

   #ifdef __cplusplus         // beginning of file
      extern "C" {
   #endif

   #ifdef __cplusplus         // end of file
      }
   #endif

The include files from earlier versions of C do not specify that "C" linkage should be used, so "C++" linkage is used. This means that the names of the routines are decorated and the linker can't match them to the actual names, hence the L2029 errors.

RESOLUTION

Make sure that the INCLUDE environment variable is set to the directory that contains the include files for the version of the compiler that you are using.


Additional reference words: 7.00 1.00
KBCategory: kbtool kbprb
KBSubcategory: TlsMisc
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.