Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

F77 source codes on intel

anand_b_
Beginner
1,158 Views

hi

i have old source codes in f77, written some 20 yr back. the code in its parent form gets compiled using ifort. however if any change is made or file is edited without disturbing code (say if i rename input data file in source code or delete some extra line) it shows lot of errors and aborts compilation.

the f77 or gfortran says        fort77 x.f
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib/libf2c.so: undefined reference to `MAIN__'
collect2: error: ld returned 1 exit status
 

i am using ubuntu 14.04 ifort version 16 (composer ed)

what should i do

 

anand

 

 

0 Kudos
3 Replies
TimP
Honored Contributor III
1,158 Views

If your Fortran main procedure is written in Fortran 66 (starting off without any PROGRAM, SUBROUTINE, or FUNCTION statement), add the PROGRAM statement so that it doesn't get lost.

You can compile but not link when you don't have a main or PROGRAM procedure.  gfortran|ifort -c x.f

If you want to make edits which break the traditional Fortran fixed form, you'd be better off changing your files to .f90 (e.g. by first using one of the f77 to f90 converter programs in case you have any continuation lines).  That doesn't require any syntax modernization.

You've given no reason for using the ancient f2c translator.  gfortran and ifort will handle many common extensions to Fortran77 which f2c will not.

gcc-help mailing list is a better forum for gcc and gfortran when you don't use any Intel software tools.
 

0 Kudos
anand_b_
Beginner
1,158 Views

thanx Tim

my source codes are written in fortran 77.  as correctly pointed out, my prog has many continuation lines. from where can i get f77 t0 f90 converter.

i did not use use any f2c converter. 

1   the ifort compiler ifort x.f says   compilation aborted for phase.f (code 1)

i then replaced implicit *8 (a-....) by implicit none

what other changes should i make in my source code where the lines are breaking and continuing

2 how can parent file run then using ifort. the same problems/ errors should appear which surprisingly are not happening. 

anand

 

0 Kudos
Steven_L_Intel1
Employee
1,158 Views

You don't need any converter. Intel Fortran can compile F77 source without anything special.

The problem in your first post is that the source you compiled does not contain a main program - it may be just a subroutine or function. Since you didn't show us the source, that's as far as we can speculate.

The "compilation aborted" message is shown only after specific error messages are displayed, but you didn't tell us what those were. I don't recommend making source edits that you don't understand. Get the original source compiling first, then think about what you want to change. IMPLICIT, other than IMPLICIT NONE, is bad programming practice, but your existing code may have assumed IMPLICIT.

Show us what the real error messages are and, if you can, the source.

0 Kudos
Reply