Saturday, February 24, 2018

Guidelines for Setting up Fortran77 Compiler in Codeblocks

Step 1: Download the Codeblocks IDE along with FORTRAN from the official website.

Step 2: After download, install or update the Codeblocks with FORTRAN
Step 3: When the installation is over, open the Codeblocks.
Step 4: If your installation was right, the home screen of Codeblocks must have Fortran in the menu bar as shown in the following snapshot:

Step 5: From the menubar, click on setting and then click on the compiler from menu list.
Step 6: Following window with name “Global Compiler Setting” will appear on the screen:
Step 7: Click on the Toolchain executables tab to obtain following:

Step 8: In the C compiler, select gcc.exe by clicking on the button with three dots on the right. Similarly, select g++.exe for C++ compiler and select gfortran.exe for Linker for dynamic libraries as following:

Step 9: Click on OK. Now, you have successfully configured FORTRAN compiler.
Step 10: Create an empty file and type following hello world program on FORTRAN
c      WAP in FORTRAN to display Hello World!
       program helloworld
       write(*,*) ‘Hello World!’
       end program helloworld
The snapshot is:

Step 11: Press Ctrl + S to open Save file dialog box. In the dialog box save the file as type Fortran77 instead of C/C++ and give the file name with extension .f, you may use hello.f for this example. Then click on Save

Step 12: Now, build/compile hello.f and run it to get the following output:

Using similar procedure you guys must be able to compile any FORTRAN77 program on Codeblocks.


Post a Comment