
Static variables inside a class, in an extension DLL
I've got a class, that is exported from an Extension DLL, which has some
const static variables. For example:
class AFX_EXT_CLASS myClass {
public:
const static TCHAR * m_acString1;
const static TCHAR * m_acString2;
.
.
.
Quote:
}
And in my .cpp file:
const TCHAR * myClass::m_acString = _T("ABC");
const TCHAR * myClass::m_acString = _T("XYZ");
I also have some child classes...i.e.
class AFX_EXT_CLASS myClass2 : public myClass {
.
.
.
Quote:
}
class AFX_EXT_CLASS myClass3 : public myClass {
.
.
.
Quote:
}
}
No problem, compiles fine.
Now I've got an application that _uses_ the above class - when I compile the
applicaiton, I get a slew of the ever-so-popular LNK2001 error, saying that
it cannot find m_acString1 or m_acString2. This is interesting - becuase the
application does _not_ directly use either of these variables. Nor are these
the only static variables available - they simply are the only ones that are
blowing up.
Does anyone know any tricks when dealing with static member data in a DLL?
What am I missing?
Thanks.
--
+--------------------------------------------------------------------+
| Andrew Akins |
+--------------------------------------------------------------------+
| IMTU: tc++(**) ru+ ge 3i+ jt- au+ ls+ kk+ hi+ as+ va+ dr+ so+ zh+ |
| vi+ da+ |
| Geek: GCS d- s+:+ a- C++ W++ w+++(-)$ PS+ PE t- 5++ X+ R+++ tv+ |
| b+++ DI+ D-- G e+ h---- r+++ y++++ |
+--------------------------------------------------------------------+