Possible Duplicate:
static,extern,constin header file
I am working in Visual C++ and having this error.
I have declared below two extern lines in global.h seperately.
extern CSocketManager m_SocketManager[10];
extern CSocketManager* m_pCurServer;
1>ServerSocketDlg.obj : error LNK2001: unresolved external symbol "class CSocketManager * m_pCurServer" (?m_pCurServer@@3PAVCSocketManager@@A) 1>SocketManager.obj : error LNK2001: unresolved external symbol "class CSocketManager * m_pCurServer" (?m_pCurServer@@3PAVCSocketManager@@A)
Does anyone have an idea what might cause these errors?
Objects declared in the .h as extern also have to be declared in a .cpp file.
The problem is that linker doesn’t know where to find the two objects.
Solution: you also have to declare m_pCurServer in the .cpp file because it’s the .cpp that is being compiled, not the header.