PDA

View Full Version : dependson( )



legacy-segall
09-08-2003, 04:39 AM
I want to share an enum between multiple classes that are separate in the class tree, so I created a class derived from Object and put the enum in there. In all the classes where I need to know about this enum, I include the dependson(common) specifier in the class declaration. Then I use "var common.theEnum myEnum;" wherever I need it. That's the way that feature works, AFAIK.

Here's the part that's screwed up. I have one class derived from Actor, one class derived from Pawn, and both need to know about the enum, so I made them both depend on the common class. But it works for the one derived from Pawn but not for the one derived from Actor! I can't see how these classes differ in such a way that would cause this behavior. In fact, I can't see anything at ALL that would account for it.

I even tested it on another of my classes that derives straight off Actor, and that worked. I made it depend on the common class and tried to create an instance of the common enum, and it worked fine. Clearly, WTF is going on?

I could just locally copy the enum into the class where it doesn't work, but that's pretty sloppy. I just want to know why it isn't working when I do it The Right Way (tm).

Can provide source files, but maybe someone already knows the answer...

edit - forgot to actually mention the error description: Error, Unrecognized type 'theEnum' within 'common'

legacy-segall
10-16-2003, 06:38 PM
bump

What I wouldn't give to be able to do this

#include "common.h"

:mad:

legacy-DragonRider
10-16-2003, 07:12 PM
I could be stupid but do you have to include the class? If its shared/loaded already then you just use the way Epic does where its:


var theEnum myEnum;

legacy-segall
10-17-2003, 01:54 AM
That was one of the first things I tried. It does not work.

elmuerte
10-17-2003, 03:44 AM
Originally posted by segall
bump

What I wouldn't give to be able to do this

#include "common.h"

:mad:
you are,
#include filename
is allowed, however it could make it more difficult for you to find errors because the line numbers will become screwed up.
the filename is relative to the package directory

legacy-Ron Prestenback
10-17-2003, 08:02 PM
How about


var TheClassWhereIDeclaredTheEnum.TheEnum MyEnumVar;


DependsOn() may or may not be necessary depending on which class the compiler attempt to compile first. DependsOn() simply tells the compiler to compile the other class first.