PRB: Using Old Include Files with C 7.0 May Cause L2029

ID Number: Q83869

7.00 | 7.00

MS-DOS | WINDOWS

Summary:

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. 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 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 C/C++ version 7.0 include files.

Additional reference words: 7.00