问题描述
在尝试从Fortran 77程序中编译复制代码时出现此错误。 code:
900格式(1H0,2X,'ABSOLUTE RADAR',I3,'XMIN-XMAX',2F8.3,'YMIN-YMAX',2F8.3,'ZMAX',F8.3,/ 3X,'方位极限',2F8的数据保持的网格极限2,3X,'AND RANGE LIMITS OF',2F10.3,/)
编译器错误:
messy21.f90:529.132:
N FOR RADAR',I3,'XMIN-XMAX' ,2F8.3,'YMIN-YMAX',2F8.3,'ZMAX',F8.3,/ 3X,(1)
错误:格式化字符串的意外结束)
我不确定错误是什么意思。
使用所谓的连续标记(&)来分隔很长的FORMAT声明,即
900格式(1H0,2X,'雷达数据保留绝对网格极限',I3,'XMIN- XMAX',2F8.3,'YMIN-YMAX',2F8.3,'ZMAX',F8.3,&
/ 3X,'方位极限',2F8.2,3X'和范围限制',2F10.3,/)
阅读一些Fortran 90/95/2003书籍或关联Fortran标准部分。例如,在Fortran 2003 Standard(中,PDF,5MB )部分3.3来源表格包含相关信息。
Getting this error while trying to compile a copied code from a Fortran 77 program.
code:
900 FORMAT(1H0,2X,'ABSOLUTE GRID LIMITS FOR DATA RETENTION FOR RADAR',I3,' XMIN-XMAX ',2F8.3,' YMIN-YMAX ',2F8.3,' ZMAX ',F8.3, /3X,'WITH AZIMUTH LIMITS OF',2F8.2, 3X,'AND RANGE LIMITS OF',2F10.3,/)
compiler error:
messy21.f90:529.132:
N FOR RADAR',I3,' XMIN-XMAX ',2F8.3,' YMIN-YMAX ',2F8.3,' ZMAX ',F8.3, /3X,(1)
Error: Unexpected end of format string in format string at (1)
I am not sure what the error means.
My guess (on the basis of error position in the line, 132) would be: starting from Fortran 90 we use free source form (free-form source input). Each line may contain up to 132 character. And if your statement is even bigger you can use up to 39 (255 in current Fortran 2003 standard) continuation lines. Fortran 77 used fixed source form which is just another story.
Use so-called continuation mark (&) to divide your very long FORMAT statement, i.e.
900 FORMAT(1H0,2X,'ABSOLUTE GRID LIMITS FOR DATA RETENTION FOR RADAR',I3,' XMIN-XMAX ',2F8.3,' YMIN-YMAX ',2F8.3,' ZMAX ',F8.3, &
/3X,'WITH AZIMUTH LIMITS OF',2F8.2, 3X,'AND RANGE LIMITS OF',2F10.3,/)
Read some Fortran 90/95/2003 book or associated section of Fortran standard. For example, in Fortran 2003 Standard (Final Committee Draft, PDF, 5MB) section "3.3 Source form" contains relevant information.
这篇关于错误:Fortran格式字符串中的格式字符串意外结束的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!