Basic 7.10 LINK "L4051 Cannot Find Library" If Using 7.00 .LIB (68158)



The information in this article applies to:

  • Microsoft Basic Professional Development System (PDS) for MS-DOS and MS OS/2 7.0
  • Microsoft Basic Professional Development System (PDS) for MS-DOS and MS OS/2 7.1

This article was previously published under Q68158

SUMMARY

If you get the linker warning message "L4051 : BCL70xxx.LIB : cannot find library" while linking a program in Basic PDS version 7.10, the problem may be that you are linking to a .LIB library you created with Basic PDS 7.00. This will happen even if Basic PDS version 7.00 has been deleted from your hard disk. If you created your own .LIB library in 7.00 and then link it to your Basic 7.10 module, then you will need to recompile the Basic routines in the .LIB using Basic version 7.10 and rebuild the .LIB library (using the LIB.EXE Library Manager).

The L4051 error can also occur because of an incorrectly set LIB path. Type SET at the MS-DOS command line to be sure that the LIB environment variable points to the Basic 7.10 libraries. You can set the LIB path (automatically at boot time) in your AUTOEXEC.BAT batch file as follows:
   SET LIB=C:\BC71\LIB
				
This information applies to Microsoft Basic Professional Development System (PDS) version 7.10 for MS-DOS and MS OS/2.

MORE INFORMATION

To duplicate the "L4051 : cannot find library" warning, build a library from the following code using Basic version 7.00:
'test.bas
'demo file built with Basic PDS 7.00
SUB Pds70sub
print "this is from the library built with PDS 7.00"
END SUB
				
Compile and build the library as follows in Basic version 7.00:
   BC /O /Fs test ;
   LIB mylib + test ;        [builds MYLIB.LIB]
   LINK /Q mylib.lib,mylib.qlb,,qbxqlb.lib ;    [links MYLIB.QLB]
				
Then create a module to CALL the above SUBprogram Pds70sub from the library MYLIB:
'main.bas
'This module calls the SUBprogram in a library created with PDS 7.00
print "this is the calling module"
call pds70sub
				
Compile and link as follows in Basic version 7.10:
   BC /O /Fs main ;
   LINK main,,,BCL71EFR.LIB + MYLIB.LIB ;
				
Now you should receive the warning message:
LINK : warning L4051 : BCL70EFR.lib : cannot find library
Enter new file spec:
To correct the problem, recompile, relink, and rebuild the library MYLIB using Basic PDS version 7.10.

Modification Type:MajorLast Reviewed:10/20/2003
Keywords:KB68158