I have upgraded a project from VS2003 to VS2005. Modified database structure, added and modified classes. Now, I can not add or delete any classes. I received Link error LNK2001, LNk2019 and LNK 1120. Total 74 link error messages to data. Error message sample:
NewCertificate.obj : error LNK2001: unresolved external symbol "public: static int __cdecl CData::GetOwnerList(int,class CListT<struct tagOWNER> &)" ( GetOwnerList@CData@@SAHHAAV $CListT@UtagOWNER@@@@@Z)
The CData is my own class.
The weird thing is after I add a class and before I close the solution, the project works fine, doesn't get any linking error. Once I close the solution and open again, the linking errors appear.
The worse thing is all the old copy which worked before it crashed, no longer works.

Problem Adding or deleting classes
Baskaran9324
The problem is that I have Data.cpp and data.cpp in the project. data.cpp is an empty one.Two of them have been together for a long time and never cause link error until now. I remove data.cpp, and the project works fine now.
Thanks
gav135
Thank you very much for your reply!!
in my Data.h:
static
int GetOwnerList(CStringList &ownerList);//returns number of records foundand in my Data.cpp:
int
CData::GetOwnerList(CStringList &ownerList){
int nCount = 0;COwnerSet ownerSet;
if(!ownerSet.IsOpen())ownerSet.Open();
if(ownerSet.GetRecordCount() <= 0){
ownerSet.Close();
return nCount; // nothing found}
do{
nCount++;
ownerList.AddTail(ownerSet.m_Last +
" " + ownerSet.m_First);ownerSet.MoveNext();
}
while(!ownerSet.IsEOF());ownerSet.Close();
return nCount;}
Every object related to CData.obj get a Link error.
CertificateItem.obj : error LNK2019: unresolved external symbol "public: static int __cdecl CData::UpdateCertificateItem(struct tagCERTIFICATE_ITEM &)" ( UpdateCertificateItem@CData@@SAHAAUtagCERTIFICATE_ITEM@@@Z) referenced in function "public: int __thiscall CCertificateItem::Save(int)" ( Save@CCertificateItem@@QAEHH@Z)
CertificateView.obj : error LNK2019: unresolved external symbol "public: static int __cdecl CData::GetCertificateType(struct tagCertificateType &)" ( GetCertificateType@CData@@SAHAAUtagCertificateType@@@Z) referenced in function "protected: virtual void __thiscall CCertificateView::OnPrint(class CDC *,struct CPrintInfo *)" ( OnPrint@CCertificateView@@MAEXPAVCDC@@PAUCPrintInfo@@@Z)
StockTracerDoc.obj : error LNK2001: unresolved external symbol "public: static int __cdecl CData::GetCertificateType(struct tagCertificateType &)" ( GetCertificateType@CData@@SAHAAUtagCertificateType@@@Z)
ChangeStatus.obj : error LNK2019: unresolved external symbol "public: static int __cdecl CData::GetOwnerList(int,class CListT<struct tagOWNER> &)" ( GetOwnerList@CData@@SAHHAAV $CListT@UtagOWNER@@@@@Z) referenced in function "protected: void __thiscall CChangeStatus::fillOwners(int)" ( fillOwners@CChangeStatus@@IAEXH@Z)
FirstMeetingShareHolders.obj : error LNK2001: unresolved external symbol "public: static int __cdecl CData::GetOwnerList(int,class CListT<struct tagOWNER> &)" ( GetOwnerList@CData@@SAHHAAV $CListT@UtagOWNER@@@@@Z)
NewCertificate.obj : error LNK2001: unresolved external symbol "public: static int __cdecl CData::GetOwnerList(int,class CListT<struct tagOWNER> &)" ( GetOwnerList@CData@@SAHHAAV $CListT@UtagOWNER@@@@@Z)
CompanySheet.obj : error LNK2001: unresolved external symbol "public: static int __cdecl CData::GetOwnerList(int,class CListT<struct tagOWNER> &)" ( GetOwnerList@CData@@SAHHAAV $CListT@UtagOWNER@@@@@Z)
ChangeStatus.obj : error LNK2019: unresolved external symbol "public: static int __cdecl CData::GetActionsList(class CListT<struct tagJournalAction> &)" ( GetActionsList@CData@@SAHAAV $CListT@UtagJournalAction@@@@@Z) referenced in function "protected: void __thiscall CChangeStatus::fillActions(void)" ( fillActions@CChangeStatus@@IAEXXZ)
ListBar.obj : error LNK2001: unresolved external symbol "public: static int __cdecl CData::GetActionsList(class CListT<struct tagJournalAction> &)" ( GetActionsList@CData@@SAHAAV $CListT@UtagJournalAction@@@@@Z)
ChangeStatus.obj : error LNK2019: unresolved external symbol "public: static int __cdecl CData::InsertJournal(struct tagJOURNAL &)" ( InsertJournal@CData@@SAHAAUtagJOURNAL@@@Z) referenced in function "protected: int __thiscall CChangeStatus::TransferCertificate(struct tagOWNER *)" ( TransferCertificate@CChangeStatus@@IAEHPAUtagOWNER@@@Z)
NewCertificate.obj : error LNK2001: unresolved external symbol "public: static int __cdecl CData::InsertJournal(struct tagJOURNAL &)" ( InsertJournal@CData@@SAHAAUtagJOURNAL@@@Z)
StockTracerDoc.obj : error LNK2001: unresolved external symbol "public: static int __cdecl CData::InsertJournal(struct tagJOURNAL &)" ( InsertJournal@CData@@SAHAAUtagJOURNAL@@@Z)
ChangeStatus.obj : error LNK2019: unresolved external symbol "public: static int __cdecl CData::InsertCertificateItem(struct tagCERTIFICATE_ITEM &)" ( InsertCertificateItem@CData@@SAHAAUtagCERTIFICATE_ITEM@@@Z) referenced in function "protected: int __thiscall CChangeStatus::TransferCertificate(struct tagOWNER *)" ( TransferCertificate@CChangeStatus@@IAEHPAUtagOWNER@@@Z)
ChangeStatus.obj : error LNK2019: unresolved external symbol "public: static int __cdecl CData::GetCertificateItemList(int,class CListT<struct tagCERTIFICATE_ITEM> &)" ( GetCertificateItemList@CData@@SAHHAAV $CListT@UtagCERTIFICATE_ITEM@@@@@Z) referenced in function "protected: int __thiscall CChangeStatus::TransferCertificate(struct tagOWNER *)" ( TransferCertificate@CChangeStatus@@IAEHPAUtagOWNER@@@Z)
StockTracerDoc.obj : error LNK2001: unresolved external symbol "public: static int __cdecl CData::GetCertificateItemList(int,class CListT<struct tagCERTIFICATE_ITEM> &)" ( GetCertificateItemList@CData@@SAHHAAV $CListT@UtagCERTIFICATE_ITEM@@@@@Z)
Charl46436
I am sorry but you will need to include more details including source code to be able to reproduce the issue.
Fomr the error, it looks like GetOwnerList is not defined.
Thanks, Ayman Shoukry VC++ TeamMario Moore
The requested function was a list of struct of type OWNER... you show us code about a CStringList. There is still a missing implementation.
Also all the other linker errors. Code the functions you have defined and the errors will go away.
Eng. A. Kilani
Thank you for your answer. The solution was working proviously when we add a class the link error appeared. In fact when we add an empty dialog class, the link error appeared. No other changes are made and no error referrence the new class.
If we delete the .suo and .user file. The project will be built correctly the first time. A second build without deleting these files causes the link errors. Would there be some setup problems