Addressing Compilation Errors

When IDL encounters a compilation error — incorrect syntax or some other situation that prevents IDL from compiling the a routine — it displays a message in the Console view that contains a hypertext link to the line of code that caused compilation to halt. This allows you to quickly locate errors and recompile.

To see this feature in action, do the following:

  1. Open a new IDL Source File.
  2. Enter the following code:
  3. PRO errorfile 
     
    PRINT a 
     
    END 
     

    Note that there is no comma following the PRINT command — this is an IDL syntax error and will keep the routine from compiling.

  4. Save the file into an existing project.
  5. Compile the file.

Note the error message in the Console view:

debug_sytax_error_console.gif

Clicking on the underlined text opens the file containing the error and highlights the specified line.

In the editor, the line containing the error is marked with a red X:

debug_sytax_error_editor.gif

Note also that errors are listed in the Problems view:

debug_sytax_error_problems.gif

Here, clicking on the error in the table will display the affected file and highlight the relevant line.

Finally, both the affected file and the project that contains it are marked in the Project Explorer view:

debug_sytax_error_proj_explorer.gif

It will, of course, be up to you to determine how to address compilation errors when they occur.