Getting started with FortranIn the Fortran builder most work is done in projects. The project folder should contain all the files for the current project, including input and output files. Creating your first project- After opening the program for the first time, go to file → new → new project and the "create project" menu will open
- Recommended project type for first time users is "Console Application" but there are others options
- Console Application: A Fortran program or application that uses a console window for i/o.
- Static Library: A library of routines that can be statically linked into a program
- Simdem Application: A Fortran program or application that uses the Simdem library for plotting or menu based programming. There are over 60 template programs provided.
- Lapack Application: A Fortran program or application that uses the Lapack linear algebra library. NAG provide over 15 templates with several examples per template.
- Dynamic Link Library: A library that can be linked to dynamically by a program or application. The program can be written in another language, e.g. C++ Visual Basic. The application could be Excel or Matlab for example.
- You can either look at the templates for "Console Application" or create a blank project.
Creating a new file- After creating a project. You need to create a file. File→new→ file (ctrl+N)
- To create a fortran script choose a .f90 file (Fortran90). It's common practice to name the first file in a program "main"
- You are now ready to start programming in Fortran.
Hello WorldCopy the code snippet bellow to create your first program. It will print "Hello world" to the i/o window.
Code Block |
---|
program main
implicit none
print *, 'Hello World'
end program |
Execute a programTo run a script click the lightning symbol on the toolbar. This will execute the script without debugging features. The play button next to the lightning will execute the script with debugging features
|