I'm working on a project and I'm getting a compiler error I can't figure out:
Error 2 error LNK2001: unresolved external symbol "private: static int CCustomer::m_nNextNumber" (?m_nNextNumber@CCustomer@@0HA)
This error occurs in the file Customer.obj, and I get an unresolved linker error in file Queue.exe.
It's a linker error so I obviously need to include something differently or maybe use the keyword
extern somewhere, but I can't seem to figure out how.
My static function that will return the next ticket number
cpp
// declared in my .h
static int GetNextNumber();
// definition in .cpp
int CCustomer::GetNextNumber()
{
return m_nNextNumber, m_nNextNumber++;
}
// where m_nNextNumber is
static int m_nNextNumber
and I'm adding to a Queue class such as:
cpp
void CQueue::Enqueue( const Item &item )
{
tNode *temp = new tNode( item, 0 );
// I'm not sure if this is right either
// my code is generic so Item is a typedef
temp->data.GetNextNumber();
if( !m_pHead )
m_pTail = m_pHead = temp;
else
{
m_pTail->next = temp;
m_pTail = temp;
}
++m_nSize;
}
Thanks in advance
This post has been edited by Psionics: 14 Oct, 2008 - 11:59 PM