最近用用tlink.exe链接多个obj的时候,老是出现undefined symbol '****'的错误,我本来链接语法是这样的,tlink a.obj b.obj,不过查了很多资料之后发现应该指明库才可以,这样修改就可以了
tlink a.obj b.obj c0s.obj,,,cs.lib,
我写了一个批处理,感兴趣的可以看一下:
@echo off
:: -----------------------------------------------------------
set BC=C:/bc31/
set LIB=%BC%lib/
set INCLUDE=%BC%INCLUDE/
set PATH=%BC%bin;%LIB%;%INCLUDE%
:: -----------------------------------------------------------
echo Turbo Link Version 5.1 Copyright (c) 1992 Borland International
echo Syntax: TLINK objfiles, exefile, mapfile, libfiles, deffile
echo @xxxx indicates use response file xxxx
echo /m Map file with publics /x No map file at all
echo /i Initialize all segments /l Include source line numbers
echo /L Specify library search paths /s Detailed map of segments
echo /n No default libraries /d Warn if duplicate symbols in libraries
echo /c Case significant in symbols /3 Enable 32-bit processing
echo /o Overlay switch /v Full symbolic debug information
echo /P[=NNNNN] Pack code segments /A=NNNN Set NewExe segment alignment
echo /ye Expanded memory swapping /yx Extended memory swapping
echo /e Ignore Extended Dictionary
echo /t Create COM file (same as /Tdc)
echo /C Case sensitive exports and imports
echo /Txx Specify output file type
echo /Tdx DOS image (default)
echo /Twx Windows image
echo (third letter can be c=COM, e=EXE, d=DLL)
:: CC为默认编译选项..
set CC= /x /L%LIB%
set /p C=请输入链接选项:
echo 链接文件就输入所有你要链接的obj文件即可(空格隔开)!
set /p S=输入链接文件:
tlink.exe %CC% %C% %S% c0s.obj,,,cs.lib,> @@@tmp.txt
type @@@tmp.txt
pause
del @@@tmp.txt
:: -----------------------------------------------------------
set BC=C:/bc31/
set LIB=%BC%lib/
set INCLUDE=%BC%INCLUDE/
set PATH=%BC%bin;%LIB%;%INCLUDE%
:: -----------------------------------------------------------
echo Turbo Link Version 5.1 Copyright (c) 1992 Borland International
echo Syntax: TLINK objfiles, exefile, mapfile, libfiles, deffile
echo @xxxx indicates use response file xxxx
echo /m Map file with publics /x No map file at all
echo /i Initialize all segments /l Include source line numbers
echo /L Specify library search paths /s Detailed map of segments
echo /n No default libraries /d Warn if duplicate symbols in libraries
echo /c Case significant in symbols /3 Enable 32-bit processing
echo /o Overlay switch /v Full symbolic debug information
echo /P[=NNNNN] Pack code segments /A=NNNN Set NewExe segment alignment
echo /ye Expanded memory swapping /yx Extended memory swapping
echo /e Ignore Extended Dictionary
echo /t Create COM file (same as /Tdc)
echo /C Case sensitive exports and imports
echo /Txx Specify output file type
echo /Tdx DOS image (default)
echo /Twx Windows image
echo (third letter can be c=COM, e=EXE, d=DLL)
:: CC为默认编译选项..
set CC= /x /L%LIB%
set /p C=请输入链接选项:
echo 链接文件就输入所有你要链接的obj文件即可(空格隔开)!
set /p S=输入链接文件:
tlink.exe %CC% %C% %S% c0s.obj,,,cs.lib,> @@@tmp.txt
type @@@tmp.txt
pause
del @@@tmp.txt
保存为bat格式的就可以运行了.