简体   繁体   English

编译FORTRAN程序时出现问题

[英]Problems compiling FORTRAN program

I have to compile Fortran programs but I haven't managed to do it. 我必须编译Fortran程序,但没有设法做到。
I'm not an experienced person in this topic but I've tried to make some changes in the makefile, unfortunately the problem persists. 我不是这个主题的经验丰富的人,但是我尝试对makefile进行一些更改,不幸的是问题仍然存在。

The original makefile was: 原始的makefile是:

CC = cc
F77 = f77
CFLAGS = -g -DSOLARIS -DDEBUG   #-DINTEL -DFREEBSD  #-DDEBUG
FFLAGS = -g -c
OBJDIR= ../bin
LIB = ./sub/libsaito.a

all: shearSAITOniu shearsaito.li shearsaito shearsaito.2 \
#   shearsaito run.saito saito

shearSAITOniu: shearSAITOniu.f  ${LIB}
    f77 shearSAITOniu.f -e -o ${OBJDIR}/shearSAITOniu -g ${LIB}

shearsaito.li: shearsaito.li.f  ${LIB}
    f77 shearsaito.li.f -e -o ${OBJDIR}/shearsaito.li -g ${LIB}

shearsaito: shearsaito.f ${LIB}
    f77 shearsaito.f -e -o ${OBJDIR}/shearsaito ${LIB}

shearsaito.2: shearsaito.2.f  ${LIB}
    f77 shearsaito.2.f -e -o ../bin/shearsaito.2 -g ${LIB}

qsaito.li: qsaito.li.f ${LIB}
    f77 qsaito.li.f -e -o ${OBJDIR}/qsaito.li ${LIB}

forward: forward.f ${LIB}
    f77 forward.f -e -o ${OBJDIR}/forward ${LIB}

#shear3d: shear3d.f ${LIB}
    f77 shear3d.f -e -o shear3d ${LIB}

#run.saito: run.saito.f ${LIB}
    f77 run.saito.f -o run.saito ${LIB}

#s_saito:   s_saito.f ${LIB}
#   f77 s_saito.f -o s_saito ${LIB}

Then I made a change in CCFLAGS replacing -DSOLARIS with -D_LINUX. 然后,我对CCFLAGS进行了更改,将-DSOLARIS替换为-D_LINUX。
After doing make it appears the error message: 完成后显示错误消息:

f77 shearSAITOniu.f -e -o ../bin/shearSAITOniu -g ./sub/libsaito.a f77剪切SAITOniu.f -e -o ../bin/shearSAITOniu -g ./sub/libsaito.a
/usr/bin/f77: Illegal option: -e / usr / bin / f77:非法选项:-e
make: *** [shearSAITOniu] Error 255 制作:*** [shearSAITOniu]错误255

I'm not sure about the meaning of this error message but I also tried to replace the f77 compiler with gfortran and get this error: 我不确定此错误消息的含义,但我也尝试用gfortran替换f77编译器并得到此错误:

gfortran shearSAITOniu.f -e -o ./shearSAITOniu -g ./sub/libsaito.a gfortran剪切SAITOniu.f -e -o ./shearSAITOniu -g ./sub/libsaito.a
gfortran: error: ./shearSAITOniu: No existe el archivo o el directorio gfortran:错误:./ shearSAITOniu:不存在任何档案导演
make: *** [shearSAITOniu] Error 1 制作:*** [shearSAITOniu]错误1

I think that this programs were compiled originaly in a 32-bit machine, mine is 64-bit, but I don't know how exactly this affects. 我认为该程序最初是在32位计算机上编译的,而我的程序是64位的,但是我不知道这会如何影响。 I hope you could help me solving this issue, thanks. 希望您能帮助我解决此问题。

To compile the program shearSAITOniu with gfortran , use the commandline: 要使用gfortran编译程序shearSAITOniu ,请使用命令行:

gfortran shearSAITOniu.f -ffree-form -o ./shearSAITOniu -g ./sub/libsaito.a

This will solve the error: 这将解决错误:

gfortran: error: ./shearSAITOniu: No existe el archivo o el directorio

but not necessarily other errors you have not yet discovered. 但不一定是您尚未发现的其他错误。

This is the reason for that error: 这是该错误的原因:

-e is an option of the f77 compiler that means: Accept extended length input source lines . -ef77编译器的选项,表示: 接受扩展长度的输入源行

-o filename is an option of both the f77 and gfortran compilers that means: Create output file "filename" . -o filenamef77gfortran编译器的选项,这意味着: 创建输出文件“ filename”

-e symbol is an option of the gfortran compiler (strictly, the linker) that means: Make symbol "symbol" the entry point of the program . -e 符号gfortran编译器的一个选项(严格来说是链接器),其含义是: 使符号“ symbol”成为程序的入口点

For both the f77 and the gfortran compilers a filename that appears on the commandline that is not preceded by the option -o is interpreted as naming an input file for compiling or linking. 对于f77gfortran编译器,在命令行上出现的文件名前都没有-o选项,这被解释为为编译或链接命名输入文件。

Therefore what the failing commandline: 因此,失败的命令行是什么:

gfortran shearSAITOniu.f -e -o ./shearSAITOniu -g ./sub/libsaito.a

means to gfortran is: Compile and link the input files shearSAITOniu.f , ./shearSAITOniu and ./sub/libsaito.a ; gfortran是: 编译并链接输入文件 shearSAITOniu.f ,./ ./shearSAITOniu ./sub/libsaito.a insert debugging information in the resulting program ( -g ), and make symbol -o the entry point of the program. 在生成的程序-g )中插入调试信息 在程序的入口处添加 符号 -o

The -o is interpreted as the symbol of the option -e symbol , and ./shearSAITOniu is interpreted as an input file, which does not exist. -o被解释为选项的符号 -e 符号 ,并./shearSAITOniu被解释为输入文件,该文件不存在。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM