I am trying to use win32 event across 2 files. So I'm using extern. Basically I'm signaling a thread from main thread and thread procedure is in different file. I am getting some error msg : unresolved external symbol:
ThreadProcedure.cpp:
#include<process.h>
#include<afxmt.h>
#include<afxwin.h>
#include<iostream>
using namespace std;
UINT __cdecl MyThreadProc(LPVOID lpParameter)
{
    extern CHandle hEvent;
    cout << "waiting for getting signal..." << endl;
    DWORD ret = WaitForSingleObject(hEvent, INFINITE);
    cout << "signaled" << endl;
    // Terminate the thread
    ::AfxEndThread(0, FALSE);
    return 0L;
}
main.cpp:
#include<iostream>
#include<process.h>
#include<afxmt.h>
#include<afxwin.h>
using namespace std;
#include"Header.h"
UINT __cdecl MyThreadProc(LPVOID lpParameter);
HANDLE     hEvent;
void main()
{
    hEvent = CreateEvent(NULL, true, false, L"AnEvent");
    CWinThread* pThread;
    pThread = ::AfxBeginThread(&MyThreadProc, NULL, 0, 0, CREATE_SUSPENDED, NULL);
    pThread->m_bAutoDelete = FALSE;
    pThread->ResumeThread();
    ::WaitForSingleObject(pThread->m_hThread, INFINITE);
    delete pThread;
    system("pause");
}
ERROR:
error LNK2001: unresolved external symbol "class ATL::CHandle hEvent" (?hEvent@@3VCHandle@ATL@@A)
 
    