Creators of Quality Software

  Randy and Alysia Schwarz

  P.O. Box 1308

  Richland, WA 99352

 

Creating a Fortran console application that calls a C program with an external library (X11.lib) using Intel Fortran 10.1, with Visual Studio 2008

Below is an example of compiling a Fortran Console program that calls a C program and also calls an external library file (X11.lib).  These are the steps I need to go through to get my code to compile.  Many of these steps are specific to my code (X windows graphics, preprocessor definitions) and can be ignored if they do not apply to your application.

 

  1. Open Visual Studio 2008.  It should allow for compiling Intel programs.  If not please properly install the Intel Fortran software.  (see separate instructions on this)

  2. Create a new Fortan console application (File->New->Project), then select Intel Fortran and click on “Console Application” then select “Empty Project”.  Make sure you select the location and set the file name before clicking OK.  My application is called mcnpx_26f.

  3. Select OK.

creating fortran 1

4.  Add The Fortran files to the Fortran project. 

  1. You need to obtain the Fortran files for compiling.  If you have a patch file, you need to run that first.

  2. Right click on source file, select Add->New Folder

  3. Rename the folder to the proper directory name.  Add the following directories:

                                                               i.      dedx

                                                             ii.      f77main

                                                            iii.      fluka89

                                                           iv.      gvaviv

                                                             v.      hexs

                                                           vi.      histp

                                                          vii.      lcs

                                                        viii.      mcnpf

                                                           ix.      meshtal

                                                             x.      spabi

    1. Add the files by right clicking on the folder and selecting Add->Existing Item.

creating fortran 4

5.   Right click on the Fortran project and select Properties

creating fortran 5

6.    Under Fortran->General

a.       Set the include directory for the include files.  This is specific to your system.  Below is what I use.  Additional Include Directories:  F:\MCNPX_projects\MCNPX_SRC\MCNPX26F\v26f\src\include

b.      Preprocessor Definitions:

CHEAP; DEC; XS64; MESHTAL; RADIOG; CEM; HISTP; SPABI; DFACT; INCL; CINDER; PLOT; MCPLOT; GKSSIM; XLIB

creating fortran 6

Continue to Next Page 444

 


  • Contact Information

    Email: randyschwarz@mcnpvised.com