News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Converting older fortran files to .f90

Started by LeoIgor, July 08, 2018, 10:56:10 PM

Previous topic - Next topic

LeoIgor

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?

gd_on

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 11 64 bits (25H2), svn C::B (last version or almost!), wxWidgets 3.3.2, Msys2 Compilers 16.1.0, 64 bits (seh, posix : gcc, g++ and gfortran in C:\msys64\mingw64) or 32 bits (dwarf2, posix  in C:\msys64\mingw32).

LeoIgor

Quote from: gd_on 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

Thank you!