sorry that my english skill is baddest.
when i use c# , i dont't crazy global variable ( no problems used otehr projects static variable in member but when use static variable in MFC ,
i have a problem neither global variabel or static member variable problem too , it's LNK2019 and LNK2001 unreserved external symbols error .
when i use static variable i have declared of members
.h Source *
#pragma once #include "../CUstomCtl/CUstomCtlDlg.h" extern CCUstomCtlDlg CusDlg; // this declaration is when i use for // global variable class CGlobalClass { public: CGlobalClass(void); ~CGlobalClass(void); //static CCUstomCtlDlg CusDlg; // i want CusDlg use to other project // like static varialble };
.cpp Source *
#pragma once #include "StdAfx.h" #include "GlobalClass.h" #include "../CUstomCtl/CUstomCtlDlg.h" // CCUstomCtlDlg included CCUstomCtlDlg CusDlg = NULL; // declared like this CGlobalClass::CGlobalClass(void) { } CGlobalClass::~CGlobalClass(void) { }
// i use in other project global variable like this
#include "../MyGlobal/GlobalClass.h" // i had a include void CtestDlg::OnBnClickedButton1() { // TODO: 여기에 컨트롤 알림 처리기 코드를 추가합니다. CusDlg.DoModal(); // LNK error !! crazyed me . }
i want know Two case in MFC *
- using in global variable to other project not own project
- using in static member variable to other project not own project
please help me my head will be explosion soon .