如何为自由形式的 fortran 配置 Code::Blocks

how to configure Code::Blocks for free form fortran

我有一个 Fortran 程序,Code::Blocks IDE 抱怨一行被截断了,所以我如何在 Code::Blocks.[=14 中指定这是自由形式的 Fortran 源代码=]

来自“构建日志”选项卡,这里是警告和失败的摘录:

-------------- Build: Debug in swat_cb (compiler: GNU Fortran Compiler)---------------

mingw32-gfortran.exe -Jobj\Debug\ -Wall  -g     -c C:\Users\TZ\f90apps\SWAT\src\biozone.f -o obj\Debug\src\biozone.o
Warning: Nonconforming tab character in column 1 of line 2
Warning: Nonconforming tab character in column 1 of line 126
Warning: Line truncated at (1)
C:\Users\Tong.Zhai\f90apps\SWAT\src\biozone.f:167.72:
        if(sep_tsincefail(j)>0) sep_tsincefail(j) = sep_tsincefail(j) + 
                                                                        1
Error: Syntax error in expression at (1)

line2 为空行,但开头有一个'tab'字符

第126行如下:

<tab>implicit none

第167行如下:

  if(sep_tsincefail(j)>0) sep_tsincefail(j) = sep_tsincefail(j) + 1

line167 是许多错误中的第一个,表示该行在最后一个加号 (+) 之后被截断,即第 71 列

感谢@VladimirF 的提示,我在 CB 中找到了为 Fortran 程序设置自由格式标志的位置,这里是进入它的菜单选项:

项目 -> 构建选项...调出 'Project build options' 对话框。

在 'Compiler Flags' 选项卡中,向下滚动到 'Fortran dialect' 组,您可以在其中选中以下两个选项:

在自由格式中,整行是有意义的 [-ffree-line-length-none]

源文件使用的自由格式布局 [-ffree-form]

检查这些后,我重新编译了项目,那些关于 line truncated 的错误都没有了。