f77 circle1.f circle2.fThis will generate three files, the two object code files circle1.o and circle2.o, plus the executablefile a.out. But in the next examplewe will use two source code files. These are two differentprocesses but the Fortran compiler performs them both, so theuser usually does not need to know about it. In the previous examples, we have not distinguished between compiling and linking. Please note that object codes and executablestake a lot of disk space, so you should delete them when you are notusing them. For example, f77 circle.f -o circle.outwill compile the file circle.f and save the executble in the file circle.out. This can be accomplishedusing the -o option. f77 circle.f a.out(Note that there are several dots there that can be difficult to read!) If you need to have several executables at the same time, it is a goodidea to give the executables descriptive names. Really the compiler translates source code into object code and the linker/loadermakes this into an executable.) Examples:In the class directory there is a small Fortran program called circle.f.Then you can compile and run it by following these steps: cp /usr/class/sccm001/circle*.f. To run the program, simply type the name of theexecutable file, for example a.out.(This explanation is a bit oversimplified. for.Before you can execute the program, you have translate the program into machine readable form.This is done by a special program called a compiler.The Fortran 77 compilers are usually called f77.The output from the compilation is given the somewhat crypticname a.out by default, but you can choose another nameif you wish. When you have written a Fortran program, you should save it ina file that has the extention. You may want to use a simplereditor, like xedit which runs under X-windows. You need to use an editor to write (edit) the source code.The most common editors in Unix are emacs and vi, but these can bea bit tricky for novice users. Source code, object code, compiling, and linkingA Fortran program consists of plain text that follows certain rules(syntax). youshould log onto one of the elaine, amy, or adelbert computers. You can use any Unix workstation that has a Fortran 77 compiler.We recommend that you use either a Sun or a Dec, e.g. There is also a class taught in the CS department thatgives an introduction to Unix. The consultants at Sweet Hall have some brochures thatcan be useful. In this class, we will be using Fortran under the Unix operating system.If you have no previous experience with Unix, you will have to learn the basics on your own. If you don't have one, you should go over to Sweet Hall andopen an account ASAP. How to use Fortran under Unix Practical detailsFor the course SCCM-001 you will need an account on the lelandcomputers.
0 Comments
Leave a Reply. |