Author Topic: Converting older fortran files to .f90  (Read 130 times)

Offline LeoIgor

  • Single posting newcomer
  • *
  • Posts: 2
Converting older fortran files to .f90
« on: July 08, 2018, 10:56:10 pm »
Hello!
I have the source code for a program that was written in Fortran 77 (iFILE.F).
I get many compiler errors when I try to compile this file. I believe the problem is that many of the lines of code exceed the 72 columns allowed in Fortran 77. I want to convert this file to a .f90. Is there a simple command for CodeBlocks, command line or some fortran programm that I can use to convert this file or do I have to do it manually?

Offline gd_on

  • Regular
  • ***
  • Posts: 412
Re: Converting older fortran files to .f90
« Reply #1 on: July 09, 2018, 08:59:22 am »
have a look at gfortran compilation options (https://gcc.gnu.org/onlinedocs/gfortran/Option-Summary.html or https://gcc.gnu.org/onlinedocs/gfortran/Fortran-Dialect-Options.html#Fortran-Dialect-Options and many other web pages ...)
If your problem is the length of lines, you can add options as  -ffixed-line-length-none or -ffree-line-length-none  or -ffixed-line-length-n or -ffree-line-length-n (n max number of characters in the line).
You can also try to change the extension of the file : .F and .f have not the same defaults compilation options for example.

Anf, if you are on Windows, don't use TDM gfortran 5.1 : it's bugged !

gd_on
Windows 10 or 7, svn C::B (last version or almost!), WxWidgets 2.8.12, Compilers TDM 4.9.2 32 bits (gcc and gfortran installed in C:\MinGW32). Tests with C::B 64 bits and WxWidgets 2.8.12 or 3.1.1 (64 bits) compiled by TDM 4.9.2 in C:\MinGW64

Offline LeoIgor

  • Single posting newcomer
  • *
  • Posts: 2
Re: Converting older fortran files to .f90
« Reply #2 on: July 09, 2018, 10:55:44 am »
have a look at gfortran compilation options (https://gcc.gnu.org/onlinedocs/gfortran/Option-Summary.html or https://gcc.gnu.org/onlinedocs/gfortran/Fortran-Dialect-Options.html#Fortran-Dialect-Options and many other web pages ...)
If your problem is the length of lines, you can add options as  -ffixed-line-length-none or -ffree-line-length-none  or -ffixed-line-length-n or -ffree-line-length-n (n max number of characters in the line).
You can also try to change the extension of the file : .F and .f have not the same defaults compilation options for example.

Anf, if you are on Windows, don't use TDM gfortran 5.1 : it's bugged !

gd_on

Thank you!