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: hlcoders@list.valvesoftware.com
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

Reply via email to