- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page