Re: scope problem

new topic     » goto parent     » topic index » view thread      » older message » newer message
canadiancoder said...

Hi all, I need help with a scope problem in my Euphoria program, a fantasy combat game that I am making. I have global constants defined in one of my include files to act as symbols for sequence indexes. I have a function in another include file which takes this sequence as a parameter. The problem is that even though the 2nd include includes the first, the function can't "see" them, so I get a undefined symbol type error. The only way I see to fix this is to copy the constants (without global) into the second include file, but this seems like an ugly kludge. There must be a "proper" way to do this.

This wouldn't be a problem in 4.0, but for 3.1 the best solution is to create a third include file. Basically, you need to analyze your code to determine the dependencies. So if both file A and B need functionA, then move functionA to file C and have both A and B include it. Another alternative (for routines, at least) is to assign the routine_id of the routine to a variable defined early enough to be seen where you need it.

It sounds like you simply need to be able to see the sequences, so you could move them to their own file, and call it constants.e, or something obvious like that.

Matt

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu