Click here to Skip to main content
16,014,952 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: DLL mandatory with EXE Pin
Frederic Filiatrault4-Apr-02 12:52
Frederic Filiatrault4-Apr-02 12:52 
GeneralRe: DLL mandatory with EXE Pin
Derek Waters4-Apr-02 12:57
Derek Waters4-Apr-02 12:57 
GeneralRe: DLL mandatory with EXE Pin
Oz Ben Eliezer4-Apr-02 13:23
Oz Ben Eliezer4-Apr-02 13:23 
GeneralRe: DLL mandatory with EXE Pin
Derek Waters4-Apr-02 13:32
Derek Waters4-Apr-02 13:32 
GeneralRe: DLL mandatory with EXE Pin
moliate4-Apr-02 12:39
moliate4-Apr-02 12:39 
Generalstatic member funcs/variables Pin
moredip4-Apr-02 12:06
moredip4-Apr-02 12:06 
GeneralRe: static member funcs/variables Pin
Paul M Watt4-Apr-02 12:16
mentorPaul M Watt4-Apr-02 12:16 
GeneralRe: static member funcs/variables Pin
moredip4-Apr-02 12:48
moredip4-Apr-02 12:48 
Thanks!

Ok, so if you have a static member variable then it has to be provided with a global definition, which is what that line does, right? But what if the variable is a user-defined type? I'm getting LNK2001 errors for all of the static variables of user-defined types in my class. I'm guessing it's because VC++ doesn't know how to initialize them correctly. So here's what I've tried so far - The variables are declared in my header file as follows:
class CTracker
{
...
protected:
...
static C2DPoint **m_aCentroids;
static double ***m_aCentroidDirs;
static UINT *m_aNumPoints;
...
};

I then initialize them in my cpp file like this:
static C2DPoint CTracker::**m_aCentroids = NULL;
static double CTracker::***m_aCentroidDirs = NULL;
static UINT CTracker::*m_aNumPoints = NULL;


but i'm still getting errors like the following:
error LNK2001: unresolved external symbol "protected: static class C2DPoint * *  CTracker::m_aCentroids" (?m_aCentroids@CTracker@@1PAPAVC2DPoint@@A)


Any idea why?

Oh, and thanks again for your help so far (with this /and/ the function pointer thing!).

Pete
GeneralRe: static member funcs/variables Pin
Derek Waters4-Apr-02 13:36
Derek Waters4-Apr-02 13:36 
GeneralRe: static member funcs/variables Pin
moredip4-Apr-02 13:41
moredip4-Apr-02 13:41 
GeneralCreating an assembler program in C++ Pin
4-Apr-02 11:59
suss4-Apr-02 11:59 
GeneralMultiple Document Templates and CWinApp::OnFileNew() Pin
Anton Loukine4-Apr-02 11:39
Anton Loukine4-Apr-02 11:39 
GeneralRe: Multiple Document Templates and CWinApp::OnFileNew() Pin
Tomasz Sowinski4-Apr-02 11:45
Tomasz Sowinski4-Apr-02 11:45 
GeneralClosing in CWinApp Pin
dazinith4-Apr-02 10:56
dazinith4-Apr-02 10:56 
GeneralRe: Closing in CWinApp Pin
Christian Graus4-Apr-02 11:02
protectorChristian Graus4-Apr-02 11:02 
GeneralRe: Closing in CWinApp Pin
dazinith4-Apr-02 11:15
dazinith4-Apr-02 11:15 
GeneralRe: Closing in CWinApp Pin
Mazdak4-Apr-02 11:10
Mazdak4-Apr-02 11:10 
GeneralgetAttribute Pin
Gerosa4-Apr-02 9:20
Gerosa4-Apr-02 9:20 
GeneralCreateWindow from DLL Pin
User 66584-Apr-02 9:13
User 66584-Apr-02 9:13 
GeneralRe: CreateWindow from DLL Pin
Tomasz Sowinski4-Apr-02 9:16
Tomasz Sowinski4-Apr-02 9:16 
GeneralRe: CreateWindow from DLL Pin
User 66584-Apr-02 9:27
User 66584-Apr-02 9:27 
GeneralRe: CreateWindow from DLL [corrected] Pin
Joaquín M López Muñoz4-Apr-02 9:37
Joaquín M López Muñoz4-Apr-02 9:37 
GeneralRe: CreateWindow from DLL [corrected] Pin
User 66584-Apr-02 9:55
User 66584-Apr-02 9:55 
GeneralRe: CreateWindow from DLL [corrected] Pin
Joaquín M López Muñoz4-Apr-02 9:58
Joaquín M López Muñoz4-Apr-02 9:58 
GeneralRe: CreateWindow from DLL [corrected] Pin
User 66584-Apr-02 10:02
User 66584-Apr-02 10:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.