主题:问大家一个有关IVF9.1命令行编译链接的问题
我现在的问题是这样的:
我现在是用IVF9.1来做一个动态链接数据库guo.DLL,从而在另外一个软件A中调用该DLL文件。
源代码有两个文件:gpilhxI.f, gpilhx.f,这两个都是子程序subroutine,gpilhxI.f是gpilhx.f的父子程序,也就是说在gpilhxI.f中要调用gpilhx.f。但是,同时gpilhx.f中要调用一个静态链接数据库gpp.lib中的一个子程序。
我用的这个做课题的软件A能够自动调用fortran编译器(应该是通过执行makeusercode.txt文件中的指令来设置并且控制IVF9.1编译器)来编译链接产生我需要的guo.DLL文件,但是IVF9.1命令行编译的时候出现这个结果:gpilhx.obj : error LNK2019: 无法解析的外部符号_GPI2EX@28,该符号在函数 _GPILHX 中被引用。
我经过分析是这样的:因为gpilhx.f要使用gpp.lib中的一个子程序GPI2EX,但是在自动链接的时候编译器没有将gpp.lib链接,所以出现不认识GPI2EX的情况(我在microsoft visual studio 2005中经过验证,确实是这个原因)。
但是问题是,我做课题的这个软件必须要自动调用IVF9.1,编译链接,产生guo.dll,这样才能使用。我自己手动编译链接产生的guo.dll软件不采用。
所以唯一进行改正的方法是对makeusercode.txt进行修改,从而使得编译器链接的时候考虑gpp.lib。
下面是makeusercode.txt的源代码,我想请问大家,不知道大家明白这是什么语言吗??另外怎么修改才能使得编译器在编译链接的时候能够认识gpp.lib这个静态数据库??非常感谢大家,祝大家学习工作顺利!!
# Uncomment the following for DEBUG build, comment out for RELEASE build
#DEBUG_BUILD = 1
# Uncomment this line for INTEL Fortran, comment out for COMPAQ or DIGITAL Fortran
INTEL_FORTRAN = 1
# Uncomment this line for VC8 compatibility
USING_VC8 = 1
!ifndef USING_VC8
# Uncomment this line for VC6 compatiblity
#USING_VC6 = 1
!endif
########################## Generic part of makefile #####################
#!include <win32.mak>
########################## Path to required atutcfor.h/c files etc
INCL = -I
INCLUDEPATHS = $(INCL)$(ATUTCFORINCLUDEPATH)
########################## File Extensions #########
OBJ = .obj
OLB = .lib
DLL = .dll
CPPSUFFIX = .cpp
WIPEALL = .*
########################## Basic command macros ####
ECHO = @echo
WIPE = @del
RSC = @rc.exe
#
########################## Compiler Commands #######
C = @cl /nologo
CPP = @cl /nologo
C_ALTOBJECT = /Fo
!ifdef INTEL_FORTRAN
FORTRAN = @ifort /nologo /iface:cvf
!else
FORTRAN = @fl32 /nologo
!endif
#
########################## Compiler Options ########
C_OPTIMIZE = /O1
C_OPTC = /c /W3 /D_X86_=1 /DWIN32 /DINTEL_X86 /D_NO_PROTO /MD /Zm500 /EHsc
CPP_OPTC = $(C_OPTC) /Zc:wchar_t-
F_OPTC = /c /DWIN32 /DINTEL_X86 /G5 /MD
RSC_OPT = /l 0x809
!ifdef DEBUG_BUILD
# remove /DPROCEDURE_CALL_DEBUG to disable all embedded debug diagnostics
# and/or edit individual source files
CDEBUG = /Zi /D_DEBUG /DPROCEDURE_CALL_DEBUG
CPPDEBUG = $(CDEBUG)
# remove /d_lines to disable all embedded debug diagnostics
FDEBUG = /Zi /d_lines
RSCDEBUG = /d "_DEBUG"
!else
CDEBUG =
CPPDEBUG =
FDEBUG =
RSCDEBUG = /d "NDEBUG"
!endif
# Manifest Tool (needed with C/C++ 2005 aka VC8)
MT = @mt -nologo
#
########################## Link Commands ###########
!ifdef DEBUG_BUILD
LINKDEBUG = /DEBUG /MAP /DEBUGTYPE:CV
!else
LINKDEBUG =
!endif
C_LINK = @link
DLLOPT = /dll /OPT:NOREF
LIB_PATH = /LIBPATH:
C_OPTL = /NOLOGO /SUBSYSTEM:CONSOLE /FORCE:MULTIPLE /MACHINE:IX86 \
/NODEFAULTLIB:"libc.lib" \
/NODEFAULTLIB:"msvcrt.lib" /NODEFAULTLIB:"msvcrtd.lib" \
/NODEFAULTLIB:"msvcirt.lib" /NODEFAULTLIB:"msvcirtd.lib"
#
ALT_EXECUTABLE = /OUT:
#
!ifdef DEBUG_BUILD
# Debug build system libraries
CSYSLIBS = user32.lib gdi32.lib winspool.lib gpp.lib \
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib \
uuid.lib odbc32.lib odbccp32.lib wsock32.lib msvcrtd.lib
SYSLIBS = user32.lib gdi32.lib winspool.lib gpp.lib \
comdlg32.lib advapi32.lib shell32.lib \
wsock32.lib msvcrtd.lib
!else
# Release build system libraries
CSYSLIBS = user32.lib gdi32.lib winspool.lib gpp.lib \
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib \
uuid.lib odbc32.lib odbccp32.lib wsock32.lib msvcrt.lib
SYSLIBS = user32.lib gdi32.lib winspool.lib gpp.lib \
comdlg32.lib advapi32.lib shell32.lib \
wsock32.lib msvcrt.lib
!endif
#
#
##################### End of generic part of makefile ###################
#
ATUTCFORPATH = D:\Aspen V7\Install\AMSystem V7.0\procedures
ATUTCFORINCLUDEPATH = "D:\Aspen V7\Install\AMSystem V7.0\procedures"
AMSYSBIN = D:\Aspen V7\Install\AMSystem V7.0\Bin
#
# no user include file supplied
#
#
################### Problem specific part ###############################
Libraries = guo$(DLL)
#
Library1_Objects = gpilhxI$(OBJ) gpilhx$(OBJ) gpp$(OLB)
#
!ifdef USING_VC6
LIBATDLL = libatdllvc6
!else
!ifdef OTHER_COMPILER
LIBATDLL = atdll_support
!else
LIBATDLL = libatdll
!endif
!endif
#
# Sets the image version number in the dll
VERSION = /VERSION:22.0
#
#
build: $(Libraries)
#
guo$(DLL): $(Library1_Objects) "guo.res" $(USERTARGETS)
$(ECHO) Building Dynamic Link Library guo$(DLL)
$(C_LINK) $(LINKDEBUG) $(C_OPTL) $(DLLOPT) $(VERSION) "guo.res" "$(AMSYSBIN)\gpp$(OLB)" $(Library1_Objects) \
"$(ATUTCFORPATH)\$(LIBATDLL)$(OLB)" \
$(ALT_EXECUTABLE)"guo$(DLL)" $(USERLIBPATHS) $(USERLIBS) \
$(SYSLIBS)
!ifdef USING_VC8
$(MT) -manifest "guo$(DLL).manifest" -outputresource:"guo$(DLL)";2
!endif
$(ECHO) Dynamic Link Library built
#
#
# Version resource for guo
"guo.res": "guo.rc"
$(ECHO) Compiling guo.rc
$(RSC) $(RSC_OPT) -fo "guo.res" "guo.rc"
#
gpilhxI$(OBJ): gpilhxI.f
$(ECHO) Compiling gpilhxI.f
$(FORTRAN) $(FDEBUG) $(F_OPTC) gpilhxI.f
#
gpilhx$(OBJ): gpilhx.f
$(ECHO) Compiling gpilhx.f
$(FORTRAN) $(FDEBUG) $(F_OPTC) gpilhx.f
我现在是用IVF9.1来做一个动态链接数据库guo.DLL,从而在另外一个软件A中调用该DLL文件。
源代码有两个文件:gpilhxI.f, gpilhx.f,这两个都是子程序subroutine,gpilhxI.f是gpilhx.f的父子程序,也就是说在gpilhxI.f中要调用gpilhx.f。但是,同时gpilhx.f中要调用一个静态链接数据库gpp.lib中的一个子程序。
我用的这个做课题的软件A能够自动调用fortran编译器(应该是通过执行makeusercode.txt文件中的指令来设置并且控制IVF9.1编译器)来编译链接产生我需要的guo.DLL文件,但是IVF9.1命令行编译的时候出现这个结果:gpilhx.obj : error LNK2019: 无法解析的外部符号_GPI2EX@28,该符号在函数 _GPILHX 中被引用。
我经过分析是这样的:因为gpilhx.f要使用gpp.lib中的一个子程序GPI2EX,但是在自动链接的时候编译器没有将gpp.lib链接,所以出现不认识GPI2EX的情况(我在microsoft visual studio 2005中经过验证,确实是这个原因)。
但是问题是,我做课题的这个软件必须要自动调用IVF9.1,编译链接,产生guo.dll,这样才能使用。我自己手动编译链接产生的guo.dll软件不采用。
所以唯一进行改正的方法是对makeusercode.txt进行修改,从而使得编译器链接的时候考虑gpp.lib。
下面是makeusercode.txt的源代码,我想请问大家,不知道大家明白这是什么语言吗??另外怎么修改才能使得编译器在编译链接的时候能够认识gpp.lib这个静态数据库??非常感谢大家,祝大家学习工作顺利!!
# Uncomment the following for DEBUG build, comment out for RELEASE build
#DEBUG_BUILD = 1
# Uncomment this line for INTEL Fortran, comment out for COMPAQ or DIGITAL Fortran
INTEL_FORTRAN = 1
# Uncomment this line for VC8 compatibility
USING_VC8 = 1
!ifndef USING_VC8
# Uncomment this line for VC6 compatiblity
#USING_VC6 = 1
!endif
########################## Generic part of makefile #####################
#!include <win32.mak>
########################## Path to required atutcfor.h/c files etc
INCL = -I
INCLUDEPATHS = $(INCL)$(ATUTCFORINCLUDEPATH)
########################## File Extensions #########
OBJ = .obj
OLB = .lib
DLL = .dll
CPPSUFFIX = .cpp
WIPEALL = .*
########################## Basic command macros ####
ECHO = @echo
WIPE = @del
RSC = @rc.exe
#
########################## Compiler Commands #######
C = @cl /nologo
CPP = @cl /nologo
C_ALTOBJECT = /Fo
!ifdef INTEL_FORTRAN
FORTRAN = @ifort /nologo /iface:cvf
!else
FORTRAN = @fl32 /nologo
!endif
#
########################## Compiler Options ########
C_OPTIMIZE = /O1
C_OPTC = /c /W3 /D_X86_=1 /DWIN32 /DINTEL_X86 /D_NO_PROTO /MD /Zm500 /EHsc
CPP_OPTC = $(C_OPTC) /Zc:wchar_t-
F_OPTC = /c /DWIN32 /DINTEL_X86 /G5 /MD
RSC_OPT = /l 0x809
!ifdef DEBUG_BUILD
# remove /DPROCEDURE_CALL_DEBUG to disable all embedded debug diagnostics
# and/or edit individual source files
CDEBUG = /Zi /D_DEBUG /DPROCEDURE_CALL_DEBUG
CPPDEBUG = $(CDEBUG)
# remove /d_lines to disable all embedded debug diagnostics
FDEBUG = /Zi /d_lines
RSCDEBUG = /d "_DEBUG"
!else
CDEBUG =
CPPDEBUG =
FDEBUG =
RSCDEBUG = /d "NDEBUG"
!endif
# Manifest Tool (needed with C/C++ 2005 aka VC8)
MT = @mt -nologo
#
########################## Link Commands ###########
!ifdef DEBUG_BUILD
LINKDEBUG = /DEBUG /MAP /DEBUGTYPE:CV
!else
LINKDEBUG =
!endif
C_LINK = @link
DLLOPT = /dll /OPT:NOREF
LIB_PATH = /LIBPATH:
C_OPTL = /NOLOGO /SUBSYSTEM:CONSOLE /FORCE:MULTIPLE /MACHINE:IX86 \
/NODEFAULTLIB:"libc.lib" \
/NODEFAULTLIB:"msvcrt.lib" /NODEFAULTLIB:"msvcrtd.lib" \
/NODEFAULTLIB:"msvcirt.lib" /NODEFAULTLIB:"msvcirtd.lib"
#
ALT_EXECUTABLE = /OUT:
#
!ifdef DEBUG_BUILD
# Debug build system libraries
CSYSLIBS = user32.lib gdi32.lib winspool.lib gpp.lib \
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib \
uuid.lib odbc32.lib odbccp32.lib wsock32.lib msvcrtd.lib
SYSLIBS = user32.lib gdi32.lib winspool.lib gpp.lib \
comdlg32.lib advapi32.lib shell32.lib \
wsock32.lib msvcrtd.lib
!else
# Release build system libraries
CSYSLIBS = user32.lib gdi32.lib winspool.lib gpp.lib \
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib \
uuid.lib odbc32.lib odbccp32.lib wsock32.lib msvcrt.lib
SYSLIBS = user32.lib gdi32.lib winspool.lib gpp.lib \
comdlg32.lib advapi32.lib shell32.lib \
wsock32.lib msvcrt.lib
!endif
#
#
##################### End of generic part of makefile ###################
#
ATUTCFORPATH = D:\Aspen V7\Install\AMSystem V7.0\procedures
ATUTCFORINCLUDEPATH = "D:\Aspen V7\Install\AMSystem V7.0\procedures"
AMSYSBIN = D:\Aspen V7\Install\AMSystem V7.0\Bin
#
# no user include file supplied
#
#
################### Problem specific part ###############################
Libraries = guo$(DLL)
#
Library1_Objects = gpilhxI$(OBJ) gpilhx$(OBJ) gpp$(OLB)
#
!ifdef USING_VC6
LIBATDLL = libatdllvc6
!else
!ifdef OTHER_COMPILER
LIBATDLL = atdll_support
!else
LIBATDLL = libatdll
!endif
!endif
#
# Sets the image version number in the dll
VERSION = /VERSION:22.0
#
#
build: $(Libraries)
#
guo$(DLL): $(Library1_Objects) "guo.res" $(USERTARGETS)
$(ECHO) Building Dynamic Link Library guo$(DLL)
$(C_LINK) $(LINKDEBUG) $(C_OPTL) $(DLLOPT) $(VERSION) "guo.res" "$(AMSYSBIN)\gpp$(OLB)" $(Library1_Objects) \
"$(ATUTCFORPATH)\$(LIBATDLL)$(OLB)" \
$(ALT_EXECUTABLE)"guo$(DLL)" $(USERLIBPATHS) $(USERLIBS) \
$(SYSLIBS)
!ifdef USING_VC8
$(MT) -manifest "guo$(DLL).manifest" -outputresource:"guo$(DLL)";2
!endif
$(ECHO) Dynamic Link Library built
#
#
# Version resource for guo
"guo.res": "guo.rc"
$(ECHO) Compiling guo.rc
$(RSC) $(RSC_OPT) -fo "guo.res" "guo.rc"
#
gpilhxI$(OBJ): gpilhxI.f
$(ECHO) Compiling gpilhxI.f
$(FORTRAN) $(FDEBUG) $(F_OPTC) gpilhxI.f
#
gpilhx$(OBJ): gpilhx.f
$(ECHO) Compiling gpilhx.f
$(FORTRAN) $(FDEBUG) $(F_OPTC) gpilhx.f