PRB: Using Old Include Files May Cause L2029

ID: Q83869

7.00 | 1.00 MS-DOS | WINDOWS kbtool kbprb

The information in this article applies to:

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

Last Reviewed: July 18, 1997