Re: Need Help Creating include files.
- Posted by Brian Broker <bkb at cnw.com> Feb 25, 2005
- 608 views
Martin Berger wrote: > > Hi all, > > I need to know what I am doing wrong here: > <snip> > What am I missing? I'm brand new to programming in Euphoria. > I'm using ver 2.4 on a Win XP machine, running in a DOS window. > > I put the file var.e in the euphoria\include directory. > I set the environment variable and path according to instructions found on > the web site. > > Any help would be appreciated. > > Thanks > > Martin > See section 2.4.2 (Scope) of the reference manual (Language Definition): When you 'include' a Euphoria file in a main file (see 2.6 Special Top-Level Statements), only the variables and routines declared using the 'global' keyword are accessible or even visible to the main file. The other, non- global, declarations in the included file are forgotten at the end of the included file, and you will get an error message, "not declared", if you try to use them in the main file. So to fix your problem, do this:
-- var.e include file -- Custom type definitions global type POSITIVE(atom x) return x >= 0 end type global type NEGATIVE(atom x) return x < 0 end type
-- Brian