Static variables inside a class, in an extension DLL 
Author Message
 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++++                           |
+--------------------------------------------------------------------+



Sat, 08 Sep 2001 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. static member variable inside class

2. pure virtual classes inside MFC extension dll

3. How to export a class from Extension MFC dll to another Extension MFC dll

4. static variables in exported class having different values between dll and exe

5. static variables in exported class having different values between dll and exe

6. static template class member variable in DLL

7. Referencing static variables inside of routines..

8. Class inside DLL: Inherit from a class in an application

9. Dialog inside an Extension DLL

10. Question about static's inside a COM class

11. Static constants inside classes

12. Initializing static structures inside of classes

 

 
Powered by phpBB® Forum Software