X

Help Articles are product support tips and information straight from the NV5 Geospatial Technical Support team developed to help you use our products to their fullest potential.



10938 Rate this article:
5.0

What is the cause of the error "Variable is undefined: ENVITASK."

When I try to run my batch program that uses an ENVITask in IDL, why do I get the following error?

% Variable is undefined: ENVITASK.

Answer:

When writing ENVI extensions and batch routines it is important to include the following line of code after the PRO statement:

COMPILE_OPT IDL2

The COMPILE_OPT statement allows you to give the IDL compiler information that changes some of the default rules for compiling the function or procedure..

We recommend the use of COMPILE_OPT IDL2 in all new code intended for use in a reusable batch routine in ENVI. 

IDL2 is shorthand way of saying:

   COMPILE_OPT DEFINT32, STRICTARR

where DEFINT32 tells IDL to assume that lexical integer constants default to the 32-bit type rather than the usual default of 16-bit integers while STRICTARR will not allow the use of parentheses to index arrays, reserving their use only for functions.  It is this statement that allows the ENVITask to be interpreted as a function.

 You might note that some of the ENVI example code will exhibit this behavior if copied and pasted into an IDL PRO.  In this case, the COMPILE_OPT IDL2 should be added after the PRO statement.  For example:

PRO ExampleProgram

COMPILE_OPT IDL2

    <my code>

END

Reviewed by PS 11/10/14, KK

Please login or register to post comments.
Featured

End-of-Life Policy Enforcement for ENVI 5.3 / IDL 8.5 and Earlier Versions

5/6/2024

April 1, 2024 Dear ENVI/IDL Customer,  We are reaching out to notify you of our supported... more »

How to Upgrade licenses to ENVI 6.x / IDL 9.x

12/5/2023

What is the new Upgrade function? Starting with ENVI 6.0 and IDL 9.0, we have implemented an... more »

What to do if the 'License Administrator - License Server' for the Next-Generation License Server does not start?

6/13/2023

Background: With the release of ENVI 5.7 & IDL 8.9 and the corresponding Next-Generation licensing... more »

Next-Generation Licensing FAQ

4/28/2023

  NV5 Geospatial has adopted a new licensing technology for all future releases of our ENVI, IDL... more »

The IDL Virtual Machine

6/6/2013

What is the IDL Virtual Machine? An IDL Virtual Machine is a runtime version of IDL that can... more »