Instructions for using NETBEANS and the GNU gfortran ...

hundredhonkSoftware and s/w Development

Aug 15, 2012 (4 years and 10 months ago)


Instructions for using NETBEANS and the GNU gfortran
compiler in Windows to write and run a FORTRAN95 program
19 January 2011

1. Click on the leftmost icon in the bottom screen tray
2. Click on: Programs => Netbeans
3. Click on Netbeans IDE 6.8.1
4. When Netbeans finally loads, click on: F
ile => New Project
5. In the Categories Window Click on C/C++
6. In the Projects: Window click on C/C++ Application
7. Click on Next >
8. In the P
roject Name Box type: Fort_1  (or some other memorable name!)
9. Untick the Create Main Fi
le box (leave the Set as Main Project box ticked.)
10. Click on Finish >
11. Right Click on Source Files in the Project Box in the upper Left
12. Select Fortran File (free format) in the File Types: box
13. Click Next >
14. Type Prog1 into the File N
ame box (or some other name!).
15. Click on the down arrow next to the extension box and select F95
16. Click on Finish
17. Click on Prog1.F95 if there is not a window of that name already open.
18. Type in your FORTRAN program, subroutine or function.
19. Save your program: Click on F
ile => Save Prog1.F95
20. Compile the Fortran program by clicking on the Green Triangle on the top Symbol bar.
21. If there are no errors the program will run and display the output in a new box.
22. If there are compilation errors in the code, they will be described in the bottom box.
23. Click on View and Show Line Numbers to be able to match the error message with the
relevant line of code.
24. Correct the offending line of code and click the green triangle again.
25. Repeat until the code runs and gives the desired results.
Your first program:
print *,’Hello World!’
Add the line:
print *,’Pi = ’,4.*atan(1.)
before stop and run again.
Amend this line to read: print *,’Pi = ’,4.d0*atan(1.d0)
What changes? Why?
Add the lines:
REAL*10 one,four
print *,’Pi = ’four*atan(one)
What changes? Why?

99. To finish your session, click on: F
ile => E