Hmmm. Well I don't see how it worked in vis 2003 ok. Any way what would be the best way to make this class. Basically I want a class that holds global data (i.e. current save, current map and stuff like that) which is client side only (like g_pGlobals).
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Paul Peloski Sent: Wednesday, December 12, 2007 4:56 AM To: [email protected] Subject: Re: [hlcoders] Vis 2005 error -- [ Picked text/plain from multipart/alternative ] It's kind of funny that it works in 2003. I'm with Jay, from what you've shown it doesn't look like that code should work in any compiler. typedef PD_GlobalData* PD_GlobalDataInterface; Would make more sense at least. Regards, Paul On Dec 11, 2007 1:39 PM, Jay Stelly <[EMAIL PROTECTED]> wrote: > The compiler appears to be correct. You haven't told us what > PD_GlobalData is (struct/class/typedef?). Unless PD_GlobalDataInterface > is a typedef of PD_GlobalData I can't see how this is valid. > > Let's say PD_GlobalDataInterace is a subclass of PD_GlobalData (what I'd > guess from your arrangement anyway): > > class PD_GlobalData > {}; > > class PD_GlobalDataInterface : public PD_GlobalData > {}; > > then you could do this: > > extern PD_GlobalData *g_PDGlobals; > > static PD_GlobalDataInterface g_PDGlobalInterface; > PD_GlobalData *g_PDGlobals = &g_PDGlobalInterface; > > > > But they have to be consistent types (that includes whether or not > you're using a pointer) and you can't put a static in a header file and > expect to access it in other modules (static means it's local to one > module. So you have two type errors and a scope error in the first bit > of code. The second bit removes one of the type errors, but you've > still got the other two errors. > > Anyway I'm just guessing since I haven't seen the rest of the code. > This isn't a VS2005 issue - the code is not consistent. > > Jay > > > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Mark > Chandler > Sent: Tuesday, December 11, 2007 9:55 AM > To: [email protected] > Subject: [hlcoders] Vis 2005 error > > This is a multipart message in MIME format. > -- > [ Picked text/plain from multipart/alternative ] > I recently moved some code from a 2003 mod to a 2005 mod (vis im talking > about here) and besides the new compile sads at some syntax im getting > one > major error. It doesn't like me making a static class handle (which gets > init elsewhere). > > Ok in my h file I declared it as extern so any class including that file > can > use it. It looks like so: > extern PD_GlobalData *g_PDGlobals; > > Now in my cpp file I have it declared as: > static PD_GlobalDataInterface (g_PDGlobals); > > Then when trying to compile I get the error: > pd_globaldata.cpp(126) : error C2040: 'g_PDGlobals' : > 'PD_GlobalDataInterface' differs in levels of indirection from > 'PD_GlobalData *' > > Now I think this is caused by one being a pointer and the other not. But > when I remove the * from extern it has a bigger sad: > pd_globaldata.cpp(126) : error C2371: 'g_PDGlobals' : redefinition; > different basic types > PD_GlobalData.h(59) : see declaration of 'g_PDGlobals' > > Any ideas of how to fix this? This code ran fine under vis 2003. > > Mark [Lodle] > -- > > _______________________________________________ > To unsubscribe, edit your list preferences, or view the list archives, > please visit: > http://list.valvesoftware.com/mailman/listinfo/hlcoders > > > _______________________________________________ > To unsubscribe, edit your list preferences, or view the list archives, > please visit: > http://list.valvesoftware.com/mailman/listinfo/hlcoders > > -- _______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders _______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders

