Using Compaq Visual Fortran:
Applications to GENERATOR Source
By: B. Marchand
The first time you ever use visual FORTRAN you MUST run the
per-user setup script. Follow the steps shown in this picture. You
only need to run this once. These settings are NOT stored on your
profile. So, clearing your ECN profile does not delete the settings.
Start up Compaq Visual Fortran by selecting the Developer Studio Icon
Create a new project.
To build a FORTRAN application select the “Fortran Console
Application” from the “Projects” options list.
Under the “Project Name” box write a name for your project.
In the “Location” box select the folder where you want to store
your project. This will create a folder where all the CVF files can
be stored, including the executables!
To build a library select the “Fortran Static Library” option instead.
When prompted, check the option to create “An empty project.”
The “New Project Information” screen appears, just click OK.
2. Expand this tree to see the contents of your project.
1. Select the “File View” tab.
Under the “Source” folder add all the FORTRAN files to be compiled.
If this is a “Fortran Console Application” make sure to also add
any “.lib” library files you’ve created.
Browse through your computer and select all the appropriate files.
This is what the LISSAJOUS code project should look like.
It includes the newliss.f and twolevel.f files as well as all the
From the “Project” menu, select the “Settings …” option. Although
the default settings are appropriate for most cases, anything that
involves the use of ephemeris files requires that a file format be specified.
If the ephemeris files were compiled for the PC (Windows or Linux) then
select the “Little Endian” format. If they were compiled for SGI or Sun
platforms, then the “Big Endian” format should be specified instead.
The process of specifying these settings is presented on the next slide.
1. Select “All Configurations” for the “Settings For:” option.
2. Select the “Compatibility” category.
3. Select “Little Endian”
as the Unformatted
File Conversion format.
4. Make sure the box next to I/O format is selected.
1. Select “Debug” tab for “All Configurations”
2. Fill in the path to source and input files
Under the “Build” menu, select the second or
third options, either “Build” (F7) or “Rebuild All”.
Any errors that appear during the build process will appear
On this bottom screen. If you click on the error you will
automatically be redirected to the point on the source where
where the error appears.
There are two possible configurations, the “Release” version
and the “Debug” version. The “Debug” version is what you work with,
it contains all debugging information and results in a larger executable
than the “Release” version. Any final distributions should be in their
“Release” version. To select which of the two configurations to build,
select the “Set Active Configuration” option from the “Build Menu”. The
default configuration is the “Debug” version.
• When an executable or a library is built, the actual *.exe or *.lib file is stored
in the Project folder, under the Debug or Release directory, depending on
which configuration you chose. Note that this is not necessarily the same
directory that contains the source code. You can store the source in the
Project folder if you’d like, but it’s best to keep that in a separate location.
• All “Project” files have the extension “*.dsw”. That stands for “Developer
Studio Workspace”. These are stored directly under the Project directory.
• Once the source is compiled, and the executable is built, you should copy
the executable to the proper folder if you intend to run it from outside of the
• In specifying file locations within the FORTRAN source, via “open”
statements, it is acceptable to use UNIX file notation instead of DOS
notation. That is, you can open the file “../UNIVERSE/bodies” or you could
also try “..\UNIVERSE\bodies” or even
• For further details on use of the debugger please refer to the CVF reference
Compaq Visual Fortran (CVF): Command-Line Compilation
• From a DOS shell, run
– c:\Program Files\Microsoft Visual Studio\DF98\BIN\ DFVARS.BAT
• Command line compiler is
– C:\Program Files\Microsoft Visual Studio\DF98\BIN\ DF.EXE
• To compile GENERATOR, or any code that uses ephemeris information, it
is necessary to use a very specific set of options (highlighted in bold):
– df test.f /check:bounds /convert:little_endian /dbglibs /debug:full /fpscomp:ioformat
/nologo /traceback /debug:full /module:"Debug/" /object:"Debug/"
– Note that both the (/convert:little_endian) and the (/fpscomp:ioformat)
options are necessary for any source that uses the ephemeris files.
– In the above example, the file test.f is compiled and the result is an executable
• To build a library first one must compile the source with an additional
option, /compile_only. This option prevents the files from being linked.
For instance, to build the integrators library in GENERATOR go under the
LIB/integrators directory and type the following:
– df *.f /compile_only /check:bounds /convert:little_endian /dbglibs /debug:full
/fpscomp:ioformat /nologo /traceback /debug:full /module:"Debug/" /object:"Debug/"
– Once the files are compiled they must be assembled into a library file. This is
accomplished using the LIB command as follows:
• lib /out:libintegrators.lib *.obj
• Using libraries when building your executable:
– To compile a program with libraries simply add the libraries to the
compile line. Here’s an example:
• df newliss.f twolevel.f ..\LIB\libintegrators.lib ..\LIB\libmodel.lib
..\LIB\libconversions.lib ..\LIB\libmatrix.lib ..\LIB\libutilities.lib
..\LIB\libvector.lib /check:bounds /convert:little_endian /dbglibs
/debug:full /fpscomp:ioformat /nologo /traceback /exe:xliss