Fortran 77

Discussion in 'Mac Apps and Mac App Store' started by kneeslasher, Aug 1, 2004.

  1. kneeslasher macrumors member

    Joined:
    Jun 6, 2004
    #1
    Greetings,

    In the lab, I use LaTeX, IDL and Fortran 77 on Linux machines. On my pBook, I can seem to use LaTex (TeXshop) and IDL (6.0 for OS X). But after installing g77 on the Mac, I can't seem to figure out how to use it.

    Forgive me, I have been, previously, someone who just used Fortran rather than understood its intricacies. When I was using Linux machines, I therefore only wrote the code in Emacs as an xxxx.for file, compiled using "ifc xxx.for" to produce an a.out file which I simply ran via typing "a.out".

    Now what is the equivalent of those two steps above using g77? Any help?
     
  2. scottwat macrumors regular

    Joined:
    Oct 9, 2003
    Location:
    Ohio USA
    #2
    OK I don't use fortran but I do know enough about commandline compiling to help. The first thing to do is in the terminal once g77 is installed run "g77 --help" I couldn't get a manpage to come up by typing "man g77" normally this would be a better option but the help page is good gives you everything you need.
    From the help I can see the basic usage is "g77 [options] file" the options are optional but are listed under the the help page there. Maybe a good one for you is "g77 -o nameofoutput nameofinput" this will compile the nameofinput file into the nameofoutput program. then you can run it with ./nameofoutput.
     
  3. kneeslasher thread starter macrumors member

    Joined:
    Jun 6, 2004
    #3
    What about interoperability? I have been told that using g77 is equivalent to what I used at the lab... there a.out files from the lab should work on the Mac. But how do I run an a.out file? ./ doesn't work... And I definitely can<not> for some reason, compile .for files from the lab using g77: error free files give errors when using g77... ...
     
  4. BornAgainMac macrumors 603

    BornAgainMac

    Joined:
    Feb 4, 2004
    Location:
    Florida Resident
    #4
    FORTRAN compiled on another CPU type won't work on another CPU unless the lab has Macs with a PowerPC chip. The ones in the lab are probably Intel based so it won't run without taking the FORTRAN source over and recompiling.

    Also it's a good practice to rename your a.out to what you want the executable to be called or specify a name when you compile.
     
  5. MisterMe macrumors G4

    MisterMe

    Joined:
    Jul 17, 2002
    Location:
    USA
    #5
    Type "a.out" at the command prompt if you are in a.out's directory. Include the complete path if you are not.
     
  6. kneeslasher thread starter macrumors member

    Joined:
    Jun 6, 2004
    #6
    Ah yes. I had forgotten about the fact that compiled a.out's were specific... well in that case I will, obviously, limit myself to working with the source .for program text file. Typing a.out does not work. I don't think the a.out is recognised as an executable at all.
     
  7. bousozoku Moderator emeritus

    Joined:
    Jun 25, 2002
    Location:
    Gone but not forgotten.
    #7
    Shouldn't the extension be either .f or .f77? I thought that .for was meant to signify FORTRAN IV files.
     

Share This Page