Re: HELP! scope or interpreter problem (I think) with include files
- Posted by DerekParnell (admin) Dec 28, 2010
- 1237 views
jessedavis said...
... have numerous problems with include files like map.e, prime.e, etc. The error message says that a value internal to the include file has not been initialized. I look at the include code and the variable has clearly been set. Any thoughts as to what I am doing incorredtly ...
Here is some sample code that will give the error message you mentioned...
object x = next_prime(1000) include std/primes.e
will give us ...
c:\projects\eu_proj\eu40\include\std\primes.e:187 in function next_prime() variable list_of_primes has not been assigned a value ... called from c:\temp\test.ex:2 --> See ex.err
The workaround is to move the include statement to somewhere before the first use of any of its routines. eg...
include std/primes.e object x = next_prime(1000)
As a general principle, always put your include files near the top of your application code, before your code executes any routine from the included files.