错误:(1) 处名称中的字符无效
我正在尝试编译一个 Fortran 文件以及 FORTRAN 中的一些 .h 文件。 .h 文件包含公共变量块的定义。当我在 Fortran 中编译它们时,出现以下错误:
integer knue,ke,knumu,kmu,knutau,ktau,ku,kd,kc,ks,kt,kb,kgamma,
1
Error: Invalid character in name at (1)
发生此错误的代码是,
现在我的问题是,这个“1”是否指向错误所在?
这个错误指向的代码行是,
integer knue,ke,knumu,kmu,knutau,ktau,ku,kd,kc,ks,kt,kb,kgamma,
& kw,kz,kgluon,kh1,kh2,kh3,khc,ksnue,kse1,kse2,ksnumu,ksmu1,
& ksmu2,ksnutau,kstau1,kstau2,ksu1,ksu2,ksd1,ksd2,ksc1,ksc2,
& kss1,kss2,kst1,kst2,ksb1,ksb2,kn1,kn2,kn3,kn4,kcha1,kcha2,
& kgluin,kgold0,kgoldc
另外,使用延续的方式是否有问题。我正在使用 gfortran 来编译这个文件。
I am trying to compile a fortran file along with some .h files in FORTRAN. The .h files contain definition for common blocks of variable. When I compile them in Fortran, I get the following error:
integer knue,ke,knumu,kmu,knutau,ktau,ku,kd,kc,ks,kt,kb,kgamma,
1
Error: Invalid character in name at (1)
The code where this error occurs is,
Now my question is, does this "1" point where the error is?
The lines of code which this errors points is,
integer knue,ke,knumu,kmu,knutau,ktau,ku,kd,kc,ks,kt,kb,kgamma,
& kw,kz,kgluon,kh1,kh2,kh3,khc,ksnue,kse1,kse2,ksnumu,ksmu1,
& ksmu2,ksnutau,kstau1,kstau2,ksu1,ksu2,ksd1,ksd2,ksc1,ksc2,
& kss1,kss2,kst1,kst2,ksb1,ksb2,kn1,kn2,kn3,kn4,kcha1,kcha2,
& kgluin,kgold0,kgoldc
Also, is there something wrong with the way continuation are used. I am using gfortran to compile this file.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
看起来您正在使用 Fortran 77 样式行延续并尝试使用 Fortran 90 样式自由格式代码进行编译。您需要使用 gfortran
-ffixed-form
选项进行编译,或者使用 Fortran 90 样式行延续来格式化代码:It looks like you are using Fortran 77 style line continuations and trying to compile with Fortran 90 style free format code. You either need to compile using the gfortran
-ffixed-form
option, or format the code using Fortran 90 style line continuations:我在修改 scipy 并尝试编译它时遇到了这个问题。要使其正常工作,需要进行以下标识,并在第 5 列添加星号
*
。它适用于 Fortran 77 和 90 样式。I had this problem when modifying
scipy
and trying to compile it. The following identation was necessary to make it work, with the star*
at column 5. It works for both Fortran 77 and 90 styles.对于你的第一个问题,是的,“1”通常表示代码中发生错误的点。否则,这样的代码看起来没问题。
To your first question, yes the "1" normally denotes the point in the code where the error occurs. The code as such looks ok otherwise.
实际上 Fortran 77 延续列是第六列。
http://web.stanford.edu/class/me200c/tutorial_77/03_basics.html
Actually the Fortran 77 continuation column is number six.
http://web.stanford.edu/class/me200c/tutorial_77/03_basics.html