1

I have a fortran program and Code::Blocks IDE is complaining a line is truncated, so how do I specify this is free form fortran source code in Code::Blocks.

From the 'Build log' tab, here is an excerpt of the warnings and failures:

-------------- 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 is an empty line, but has a 'tab' character at the beginning

line126 is as follows:

<tab>implicit none

line167 is as follows:

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

line167 is the first of many errors saying the line is truncated at just after the last plus sign (+), which is column 71

For Comment
  • 1,139
  • 4
  • 13
  • 25

1 Answers1

0

Thanks to @VladimirF's hint, I found the place for setting the free form flag in CB for Fortran programs, here is the menu options to get to it:

Project -> Build options... to bring up the 'Project build options' dialog.

From the 'Compiler Flags' tab, scroll down to the 'Fortran dialect' group, where you can check the following two options:

In free form an entire line is meaningful [-ffree-line-length-none]

The free form layout used by the source files [-ffree-form]

After checking these, I recompiled the project and those errors about line truncated are gone.

For Comment
  • 1,139
  • 4
  • 13
  • 25