错误:外部未解析

时间:2013-11-09 07:40:55

标签: c++ c compiler-construction linker borland-c++

S:\builds\g2.0\upr\g\platform\client\errlib>make
MAKE Version 5.0  Copyright (c) 1987, 1997 Borland International
        tlink32 /v /ap /aa /Tpd /OS /LE:\BC5\LIB @MAKE0000.@@@
Turbo Link  Version 2.0.68.0 Copyright (c) 1993,1997 Borland International
Warning: Attempt to export non-public symbol 'WEP'
Warning: Attempt to export non-public symbol 'ERRSETDLG'
Warning: Attempt to export non-public symbol 'ERR_LOG'
Warning: Attempt to export non-public symbol 'ERR_LOG_INT'
Warning: Attempt to export non-public symbol 'HDLR_ERR_DISPLAY'
Warning: Attempt to export non-public symbol 'ISDONE'
Warning: Attempt to export non-public symbol 'RPC_RETMSG'
Warning: Attempt to export non-public symbol 'RPC_M_ON'
Warning: Attempt to export non-public symbol 'RPC_M_OFF'
Warning: .DEF file heap reserve size < 64K; 1MB default will be used
Error: Unresolved external 'B_GetUserDir' referenced from module err_log.c
Error: Unresolved external 'B_getstudyname' referenced from module err_log.c
Error: Unresolved external 'B_getcustname' referenced from module err_log.c
这些是我在编译第二个模块时得到的链接错误,即(Errlib)依赖于第一个模块lib文件,即(barlib.lib)。第一个模块已经编译,它生成了dll和.lib文件。

第一个模块制作文件(barlib)

#
# This makefile builds the BARLIB dll:
#         barlib.dll
# and a stub version:
#         sbarlib.dll
# and the associated import library:
#         barlib.lib
#
# The stub version must be renamed in order to "use" it.
#
# The following macros must be set to run this makefile:
#    PLATF_LIB       Platform library directory (i.e. c:\p3.0\client\lib)
#    PLATF_INC       Platform header directory (i.e. c:\p3.0\client\hdr)
#    PLATF_DLL       Platform DLL directory (i.e. c:\p3.0\client\dll)
#    BORLAND_LIB     Borland compiler library directory (i.e. c:\bc4\lib)
#    BORLAND_INC     Borland compiler header directory (i.e. c:\bc4\include)
#
.autodepend
# Set DEBUG to 0 (production) or 1 (development) (may be overridden
# by environment variable on build PC).
DEBUG = 1

# Common macros
NAME        =barlib
#MEMMODEL    =l
OBJS        =alltbls.obj \
             breaddir.obj \
             custudy.obj \
             getlist.obj \
             getname.obj \
             rdtbl.obj \
             rdwrdesc.obj \
             tableio.obj \
             userdir.obj
COMLIBS     =
RCFILES     =

# Application specific macros
COMBIN      =$(PLATF_DLL)
COMLIB      =$(PLATF_LIB)
COMINC      =-I$(PLATF_INC);$(BORLAND_INC)
RCINC       =-I$(PLATF_INC);$(BORLAND_INC)
LIBPATH     =$(BORLAND_LIB)
#WINLIBS     =import crtldll
WINLIBS     =import32 cw32i
LIBS        =$(COMLIBS) $(TARGETLIBS) $(WINLIBS)

# Main (default) target
goal:       $(COMBIN)\$(NAME).dll $(COMBIN)\s$(NAME).dll $(COMLIB)\$(NAME).lib

# Build options macros
!if $(DEBUG)
# Debugging options
#COMLOPT     =/v /l /m /Twd /L$(LIBPATH)
COMLOPT     =-v -aa -Tpd -L$(LIBPATH)

CLOPT       =-y -v -O-
!else
# No Debugging options
COMLOPT     =/x /Twd /L$(LIBPATH)
CLOPT       =@opt.cfg
!endif

CPU         =-3
WARN        =-w
#MEMMOD      =-m$(MEMMODEL)!
MEMMOD      =-l$(MEMMODEL)!
#CFLAGS      =bcc32 -c -P-.C -WDE -D_RTLDLL $(COMINC) $(CPU) $(MEMMOD) $(CLOPT) $(WARN)
CFLAGS      =bcc32 -c -P-.C -WDR -D_RTLDLL $(COMINC) $(CPU) $(CLOPT) $(WARN)
LINK        =ilink32 $(COMLOPT)
RC          =brc32

#  Standard inference rules
.c.obj:
    $(CFLAGS) $*.c

.rc.res:
    $(RC) $(RCINC) -r $*.rc

$(COMBIN)\$(NAME).dll: $(OBJS) $(NAME).def $(COMLIBS)
    $(LINK) @&&|
    c0d32 $(OBJS),        \ 
    $@,     \
    $(NAME).map,    \
    $(COMLIBS) $(WINLIBS),  \
    $(NAME).def
|

$(COMBIN)\s$(NAME).dll: sbarlib.obj $(NAME).def
    $(LINK) @&&|
    c0d32 sbarlib.obj,        \ 
    $@,     \
    s$(NAME).map,    \
    $(WINLIBS),  \
    $(NAME).def
|

$(COMLIB)\$(NAME).lib: $(NAME).def
    implib $@ $?

alltbls.c: ..\..\common\barlib\alltbls.c
    if exist $@ del $@
    unix2dos $? $@

breaddir.c: ..\..\common\barlib\breaddir.c
    if exist $@ del $@
    unix2dos $? $@

custudy.c: ..\..\common\barlib\custudy.c
    if exist $@ del $@
    unix2dos $? $@

getlist.c: ..\..\common\barlib\getlist.c
    if exist $@ del $@
    unix2dos $? $@

getname.c: ..\..\common\barlib\getname.c
    if exist $@ del $@
    unix2dos $? $@

rdtbl.c: ..\..\common\barlib\rdtbl.c
    if exist $@ del $@
    unix2dos $? $@

rdwrdesc.c: ..\..\common\barlib\rdwrdesc.c
    if exist $@ del $@
    unix2dos $? $@

tableio.c: ..\..\common\barlib\tableio.c
    if exist $@ del $@
    unix2dos $? $@

userdir.c: ..\..\common\barlib\userdir.c
    if exist $@ del $@
    unix2dos $? $@

clean:
    -del *.obj
    -del *.map

第二个模块make文件(errlib)

#
# This makefile builds the ERRLIB dll:
#         errlib.dll
# and a stub version:
#         serrlib.dll
# and the associated import library:
#         errlib.lib
#
# The stub version must be renamed in order to "use" it.
#
# The following macros must be set to run this makefile:
#    PLATF_LIB       Platform library directory (i.e. c:\p3.0\client\lib)
#    PLATF_INC       Platform header directory (i.e. c:\p3.0\client\hdr)
#    PLATF_DLL       Platform DLL directory (i.e. c:\p3.0\client\dll)
#    BORLAND_LIB     Borland compiler library directory (i.e. c:\bc4\lib)
#    BORLAND_INC     Borland compiler header directory (i.e. c:\bc4\include)
#
.autodepend
# Set DEBUG to 0 (production) or 1 (development) (may be overridden
# by environment variable on build PC).
DEBUG = 1

# Common macros
NAME        =errlib
#MEMMODEL    =32
OBJS        =err_log.obj \
             errhdisp.obj \
             gwrnflag.obj \
             isdone.obj \
             rcretmsg.obj
COMLIBS     = $(PLATF_LIB)\barlib.lib
RCFILES     =

# Application specific macros
COMBIN      =$(PLATF_DLL)
COMLIB      =$(PLATF_LIB)
COMINC      =-I$(PLATF_INC);$(BORLAND_INC)
RCINC       =-I$(PLATF_INC);$(BORLAND_INC)
LIBPATH     =$(BORLAND_LIB)
#WINLIBS     =import crtldll
WINLIBS     =import32 cw32i
LIBS        =$(COMLIBS) $(TARGETLIBS) $(WINLIBS)
#BARLIBPATH  =S:\builds\g2.0\upr\g\platform\client\barlib

# Main (default) target
goal:       $(COMBIN)\$(NAME).dll $(COMBIN)\s$(NAME).dll $(COMLIB)\$(NAME).lib

# Build options macros
!if $(DEBUG)
# Debugging options
#COMLOPT     =/v /l /m /Twd /L$(LIBPATH)
COMLOPT     =/v /ap /aa /Tpd /OS /L$(LIBPATH)  
CLOPT       =-y -v -O-
!else
# No Debugging options
COMLOPT     =/v /ap /aa /Tpd /OS/ /L$(LIBPATH) 
CLOPT       =@opt.cfg
!endif

CPU         =-3
WARN        =-w
MEMMOD      =-l$(MEMMODEL)!
#CFLAGS      =bcc -c -P-.C -WDE -D_RTLDLL $(COMINC) $(CPU) $(MEMMOD) $(CLOPT) $(WARN)
CFLAGS      =bcc32 -c -P-.C -WDE -D_RTLDLL $(COMINC) $(CPU) $(CLOPT) $(WARN)
LINK        =tlink32 $(COMLOPT)
RC          =brc32

#  Standard inference rules
.c.obj:
    $(CFLAGS) $*.c

.rc.res:
    $(RC) $(RCINC) -r $*.rc

$(COMBIN)\$(NAME).dll: $(OBJS) $(NAME).def $(COMLIBS)
    $(LINK) @&&|
    c0d32 $(OBJS),        \ 
    $@,     \
    $(NAME).map,    \
    $(COMLIBS) $(WINLIBS),  \
    $(NAME).def
|

$(COMBIN)\s$(NAME).dll: serrlib.obj $(NAME).def
    $(LINK) @&&|
    c0d32 serrlib.obj,        \ 
    $@,     \
    s$(NAME).map,    \
    $(WINLIBS),  \
    $(NAME).def
|

$(COMLIB)\$(NAME).lib: $(NAME).def
    implib $@ $?

err_log.c: ..\..\common\errlib\err_log.c
    if exist $@ del $@
    unix2dos $? $@

errhdisp.c: ..\..\common\errlib\errhdisp.c
    if exist $@ del $@
    unix2dos $? $@

gwrnflag.c: ..\..\common\errlib\gwrnflag.c
    if exist $@ del $@
    unix2dos $? $@

isdone.c: ..\..\common\errlib\isdone.c
    if exist $@ del $@
    unix2dos $? $@

#msg_hand.c: ..\..\common\errlib\msg_hand.c
#   if exist $@ del $@
#   unix2dos $? $@

#serrlib.c: ..\..\common\errlib\serrlib.c
#   if exist $@ del $@
#   unix2dos $? $@

rcretmsg.c: ..\..\common\errlib\rcretmsg.c
    if exist $@ del $@
    unix2dos $? $@


clean:
    -del *.obj
    -del *.map

barlib的定义文件

LIBRARY BARLIB
CODE PRELOAD MOVEABLE DISCARDABLE
DATA PRELOAD MOVEABLE SINGLE
HEAPSIZE 50000
EXPORTS
    B_INIT_TABLES                  @2   
    B_ADDSTUDY                     @3   
    B_SELSTUDY                     @4   
    B_SVSTUDY                      @5   
    B_RMSTUDY                      @6   
    B_RMWKSTUDY                    @7   
    B_CKCHANGE                     @8   
    B_DISOWNWKSTUDY                @9   
    B_RMCUSTOMER                   @10  
    B_MVCUSTOMER                   @11  
    B_GETCUSTLIST                  @12  
    B_GETSTUDYLIST                 @13  
    B_GETCUSTNAME                  @14  
    B_GETSTUDYNAME                 @15  
    B_RDTBLARRAY                   @16  
    B_RDCUSTDESC                   @17  
    B_WRCUSTDESC                   @18  
    B_RDSTUDYDESC                  @19  
    B_WRSTUDYDESC                  @20  
    B_SETWKSTUDY                   @21  
    B_TBL_OPEN                     @22  
    B_TBL_READ                     @23  
    B_TBL_WRITE                    @24  
    B_TBL_DELETE                   @25  
    B_TBL_UPDATE                   @26  
    _B_TBL_DOCHG                   @27  
    _B_TBL_UNDOCHG                 @28  
    B_TBL_TERMCHG                  @29  
    B_TBL_CLOSE                    @30  
    B_TBL_STATUS                   @31  
    B_GETUSERDIR                   @32  
    B_SETUSERDIR                   @33

请帮助解决这些链接错误。 谢谢!

0 个答案:

没有答案