Compiling and Running an IDL Program

Note
IDL program files have a .pro extension.

Running a Program Loaded into the IDL Editor

To compile and run an IDL program using the IDL Workbench:

  1. Open the file in the IDL editor.
  2. Use the Project Explorer view to select a file located in one of your projects. Double-click on the file to open it in an editor.

    Alternately, use File  Open File to select a file from the file system. For example, you could open the file examples\demo\demosrc\d_uscensus.pro from the IDL installation directory.

  3. Compile the file by selecting Run  Compile filename
  4. where filename is the name of the file opened in the IDL editor (d_uscensus.pro, in this example).

  5. Execute the file by selecting Run  run filename
  6. where filename is the name of the file opened in the IDL editor (d_uscensus.pro, in this example).

Running a Program from the IDL Command Line

When a file is specified by typing only the filename at the IDL prompt, IDL searches the current directory for filename.pro (where filename is the file specified) and then for filename.sav. If no file is found in the current directory, IDL searches in the same way in each directory specified by !PATH. If a file is found, IDL automatically compiles the contents and executes any functions or procedures that have the same name as the file specified (excluding the extension).

Using the previous example, you can run the US Census Data demo by entering the following at the command line:

d_uscensus