As part of my Final Year Project, I need to convert some FORTRAN code into C or C++ (it doesn’t matter which language as long as I can understand it, and I can understand C style languages).
I have discovered f2c, a program that allegedly converts FORTRAN to C, and tried to install it, following instructions, by saving a makefile.vc file on my drive and then doing
copy makefile.vc makefile
nmake
(here is the part of the README file about installing f2c that is included in the f2c download page)
To compile f2c on Linux or Unix
systems, copy makefile.u to makefile,
edit makefile if necessary (see the
comments in it and below) and type
“make” (or maybe “nmake”, depending on
your system).To compile f2c.exe on MS Windows
systems with Microsoft Visual C++,copy makefile.vc makefile nmake
With other PC compilers, you may need
to compile xsum.c with -DMSDOS (i.e.,
with MSDOS #defined).If your compiler does not understand
ANSI/ISO C syntax (i.e., if you have a
K&R C compiler), compile with
-DKR_headers .On non-Unix systems where files have
separate binary and text modes, you
may need to “make xsumr.out” rather
than “make xsum.out”.
I am running x64 bit version of Windows Vista and tried “nmake”, but I get
‘nmake’ is not recognised as an internal or external command, operable program or batch file.
I downloaded Nmake15.exe after some searching but it doesn’t work on x64 bit machines and apparently there is not version of it that does. So I downloaded the Windows SDK, after being told that would work, but it didn’t change anything.
Where have I gone wrong in all this, if I have, and is there any way of converting that FORTRAN code into C or C++?
I’m going to answer only the very last part of your question:
Yes there is: Read the fortran code, and write the equivalent C statements in a C file.
They are both imperative languages. The syntax is different but not impossible to decode. This will likely give you much better results than an auto-converter, and will also give you an much deeper understanding of how the original program works.