Using Compaq Visual Fortran: Creating Workspaces, Projects, and Source Files - Prof. Betty, Study notes of Electrical and Electronics Engineering

Instructions on using compaq visual fortran for creating workspaces, projects, and source files. It covers the process of creating a workspace, a project within the workspace, and a source file within the project. The document also explains how to compile and debug the source code. This information is useful for students and developers who are new to compaq visual fortran and want to learn how to use it for developing fortran console applications.

Typology: Study notes

Pre 2010

Uploaded on 08/18/2009

koofers-user-sd9
koofers-user-sd9 🇺🇸

10 documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Using Compaq Visual Fortran
The Compaq Visual Fortran development environment has many similarities to the Microsoft Visual C++
development environment. The three main areas used when writing a program are the workspace, the
project and the source file. A workspace is simply a container to easily organize projects. A project is a
container to hold any number of source files. Typically, all the source files in a project are interrelated,
often to produce a single executable program file. The hierarchy of areas, listed from highest to lowest, is
the workspace, then the project and finally the source file.
You can build many different kinds of projects with Visual Fortran. For our purposes only one, the
console application, is of interest. A Fortran console application (.exe) is a character-based program that
does not require screen graphics output. It looks similar to a program running on a UNIX workstation or a
terminal connected to a mainframe computer. Fortran console projects operate in a single window, and
let you interact with your program through normal read and write commands. Console applications are
better suited to problems that require pure numerical processing rather than graphical output or a
graphical user interface. This type of application is also more portable to other platforms than other types
of application.
Creating a Workspace
1. Once the Visual Fortran program has been started, choose the “New…” option from the “File”
dropdown menu at the top of the screen.
2. A new dialog box will appear. Choose the “Workspaces” tab.
3. Type a name for your workspace in the “Workspace Name:” edit box, for example, ece3331fort
might be a good choice.
4. Pick a location to save using the browse button (a small button with an ellipses on it). The
directory must exist before you can choose it. Visual Studio will create a directory within the
directory you choose, and it will be assigned a name identical to your workspace name.
5. Click “OK” to create the workspace.
Creating a Project
1. To create a project within your workspace, choose “New…” from the “File” dropdown menu. A
dialog box will appear.
2. Make sure you are on the “Project” tab. This should be the default tab when the dialog box
appears.
3. Select “Fortran Console Application” from the list.
4. Type a name for your project in the “Project Name:” edit box, for example, cp6 might be a good
choice.
5. Pick a location to save using the browse button (a small button with an ellipses on it). The
directory must exist before you can choose it. Visual Studio will create a directory within the
directory you choose, and it will be assigned a name identical to your project name. For example,
you could choose the ece3331fort workspace created above. Using this kind of directory
structure is a good way to organize several projects within a single workspace.
6. When the next dialog appears, make sure to choose “An empty project” and click “Finish.”
7. Click “OK” for the next dialog box.
8. On the left side of the Visual Fortran application pane, choose the “File View” tab. Notice that
your newly created project is nested within the workspace. Notice that the words “cp6 files” are
in bold letters. This means that this is the current project, and any source files created will be
added to this project.
1
pf3

Partial preview of the text

Download Using Compaq Visual Fortran: Creating Workspaces, Projects, and Source Files - Prof. Betty and more Study notes Electrical and Electronics Engineering in PDF only on Docsity!

Using Compaq Visual Fortran

The Compaq Visual Fortran development environment has many similarities to the Microsoft Visual C++ development environment. The three main areas used when writing a program are the workspace , the project and the source file. A workspace is simply a container to easily organize projects. A project is a container to hold any number of source files. Typically, all the source files in a project are interrelated, often to produce a single executable program file. The hierarchy of areas, listed from highest to lowest, is the workspace, then the project and finally the source file. You can build many different kinds of projects with Visual Fortran. For our purposes only one, the console application, is of interest. A Fortran console application (.exe) is a character-based program that does not require screen graphics output. It looks similar to a program running on a UNIX workstation or a terminal connected to a mainframe computer. Fortran console projects operate in a single window, and let you interact with your program through normal read and write commands. Console applications are better suited to problems that require pure numerical processing rather than graphical output or a graphical user interface. This type of application is also more portable to other platforms than other types of application. Creating a Workspace

  1. Once the Visual Fortran program has been started, choose the “New…” option from the “File” dropdown menu at the top of the screen.
  2. A new dialog box will appear. Choose the “Workspaces” tab.
  3. Type a name for your workspace in the “Workspace Name:” edit box, for example, ece3331fort might be a good choice.
  4. Pick a location to save using the browse button (a small button with an ellipses on it). The directory must exist before you can choose it. Visual Studio will create a directory within the directory you choose, and it will be assigned a name identical to your workspace name.
  5. Click “OK” to create the workspace. Creating a Project
  6. To create a project within your workspace, choose “New…” from the “File” dropdown menu. A dialog box will appear.
  7. Make sure you are on the “Project” tab. This should be the default tab when the dialog box appears.
  8. Select “Fortran Console Application” from the list.
  9. Type a name for your project in the “Project Name:” edit box, for example, cp6 might be a good choice.
  10. Pick a location to save using the browse button (a small button with an ellipses on it). The directory must exist before you can choose it. Visual Studio will create a directory within the directory you choose, and it will be assigned a name identical to your project name. For example, you could choose the ece3331fort workspace created above. Using this kind of directory structure is a good way to organize several projects within a single workspace.
  11. When the next dialog appears, make sure to choose “An empty project” and click “Finish.”
  12. Click “OK” for the next dialog box.
  13. On the left side of the Visual Fortran application pane, choose the “File View” tab. Notice that your newly created project is nested within the workspace. Notice that the words “cp6 files” are in bold letters. This means that this is the current project, and any source files created will be added to this project.

Creating Source Files

  1. From the “Project” dropdown menu, choose “Add to Project” and then “New…” in the pop-out menu. A dialog box will appear.
  2. Make sure the “Files” tab is chosen. This should be the default when the dialog box opens.
  3. If you are creating a Fortran 77 program, select “Fortran Fixed Format Source File” in the list. If you are creating a Fortran 90/95 program, select “Fortran Free Format Source File” in the list.
  4. Type the name of your source file in the “File name:” edit box, for example “cp6” might be a good choice. You do not need to type an extension. Visual Fortran will assign a “.for” extension to Fortran 77 files and a “.f90” extension to Fortran 90/95 files. If you change this, Visual Fortran will have a problem when it tries to compile the file. The compiler must know whether the source file is fixed format or free format.
  5. You probably do not need to choose the location to save this file. The current projects directory will be listed in the “Location:” edit box.
  6. Click “OK” and the source file will be created and opened. You can now type your source code. Compiling the Source Code Visual Fortran allows you to compile either a single source file or the entire project, assuming there are many files in a particular project (this will not be the case for ECE 3331).
  7. To compile only one source file, highlight the file from the Source Files list in the left hand pane of the Visual Fortran application window. From the “Build” dropdown menu, choose “Compile filename.ext ,” where filename.ext will be the source file that you have highlighted. Any errors in the source file will be listed at the bottom of the screen.
  8. To compile the entire project, choose “Build” from the dropdown menu and then choose “Build project.exe ,” where project.exe is the project you wish to compile. This command will compile all source files within the project, link their respective object files and create an executable file assuming there are no errors.
  9. If errors arise during compilation of the source code, they will be listed in the “Build” window at the bottom of the Visual Fortran application window. Simply double-click on the error message, and the line of code that contains the error will be highlighted. Debugging the Source Code One of the nice features of Compaq Visual Fortran is the debugging environment. It is intuitive to follow and easy to learn.
  10. The debugger can only be employed when an executable file is made. If the source code does not compile, the debugger will not be available.
  11. To force the debugger to pause execution of the program prior to reaching its end, breakpoints must be set within the program. A breakpoint is a location in a process where execution is stopped to allow the developer to examine the process's code, variables, and register values, and, as necessary, make changes, continue execution, or terminate execution.
  12. To set a breakpoint at a source-code line, do the following:  In a source window, move the insertion point to the line where you want the program to break.  Choose the Insert/Remove Breakpoint toolbar button or press F9.  A red dot appears in the left margin, indicating that the breakpoint is set.  Note. If you want to set a breakpoint on a source statement extending across two or more lines, you must set the breakpoint on the last line of the statement.
  13. To set a breakpoint at the beginning of a function (or subroutine), do the following:  In the Find box on the Standard toolbar type the function (or subroutine) name.  Click the Insert/Remove Breakpoint toolbar button or press F9.  While in debug mode a red dot appears in your source code in the left margin at the beginning of the function (or subroutine), indicating that the breakpoint is set.