A few issues I've been having with 'Import'

Monkey Forums/Monkey Programming/A few issues I've been having with 'Import'

ImmutableOctet(SKNG)(Posted 2013) [#1]
So basically, I'm porting my existing code from a game I was writing in BlitzMax. Everything was going fine(And besides this one issue, it still is), but now I'm having trouble getting 'Import' to do what I want. From what I've read, to get the closest thing to 'Include' from BlitzMax and BlitzBasic, I need to Import my project's main file in basically every sub-file.

But if I import my main file, then use code from another file which also imports it, it gives me an error telling me I have two instances of the same thing(In this case, a class).

I've tried using 'Public' and 'Private', so it doesn't import the module's imported files/modules, but that basically causes the same issue.

And if I get rid of all of the imports, it tells me I need to import [Insert module here]. Which would be fine in most situations, but in this one, I want to import those modules in the file that's importing the file that's giving me errors.

Basically, I want to be able to import the prerequisite modules inside a separate file. Or I could effectively use the same methods most people use to only include one copy of a C++ header. I'm probably going to look into something like that, but it would be nice to hear what solutions Monkey's community comes up with.

I'll be honest, chances are I'm missing an easy fix for this(Other than the one I came up with). And in the event I'm not, importing prerequisite modules would be a nice feature to have(Assuming there's no way to do it currently).

And just for the record, I'm using V66(B) on Windows 7 Ultimate 64-Bit.


MikeHart(Posted 2013) [#2]
Make sure that the filename for each subclass is not the same as the class name itself. That is one reason why I could complain.