PRB: L4051 Linking .OBJs From Compilers Earlier Than C 5.0

ID Number: Q30368

5.00 5.10 6.00 6.00a 6.00ax 7.00

MS-DOS

Summary:

SYMPTOMS

When linking object modules compiled with C version 3.0 or 4.0 with

object modules compiled with C versions 5.0 or later, the linker

may generate the following error:

L4051: cannot find library.

The linker may then prompt for the location of LLIBC.LIB, EM.LIB,

LLIBFP.LIB, and LIBH.LIB.

CAUSE

The C compilers embed references to the default libraries in each

.OBJ module. When you link, the linker detects these library names

and searches the specified libraries for any unresolved references

in the code. If the .OBJ files were compiled with C version 4.0 or

earlier, the .OBJ modules will contain the names of the component C

libraries, rather than the combined libraries that have been used

since C 5.0. Because these libraries are usually not available

under their separate names, the linker prompts you for the path

specification.

RESOLUTION

To avoid this error when linking object modules compiled with the C

version 3.0 or 4.0 compiler with object modules compiled with C

version 5.0 or later, you must list the combined C library

explicitly along with the link switch /NOD. This tells the linker

to ignore any embedded library references in the object modules.

More Information:

The following are two examples of how to link C 4.0 .OBJ files with C

5.0 or later .OBJ files:

link c4mod c5mod,,,llibce.lib/NOD;

-or-

cl c4mod c5mod /link llibce.lib/NOD;

Additional reference words: 5.00 5.10 6.00 6.00a 6.00ax 7.00