p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/)
-   BOOK: Ivor Horton's Beginning Visual C++ 2005 (http://p2p.wrox.com/book-ivor-hortons-beginning-visual-c-2005-249/)
-   -   Link error after adding serialize in sketcher (http://p2p.wrox.com/book-ivor-hortons-beginning-visual-c-2005/71864-link-error-after-adding-serialize-sketcher.html)

chang82 December 17th, 2008 05:58 AM

Link error after adding serialize in sketcher
 
Before I add serialize to Element (Both .h and .cpp), My sketcher compile well.
After I add serialize in ch17 (until to page 881 in ivor 2005 book), when I compile I got this message

------ Build started: Project:
Sketcher, Configuration: Debug Win32 ------
Linking...
Elements.obj : error LNK2019: unresolved external symbol "protected: __thiscall CLine::CLine(void)" (??0CLine@@IAE@XZ) referenced in function "public: static class CObject * __stdcall CLine::CreateObject(void)" (?CreateObject@CLine@@SGPAVCObject@@XZ)
Elements.obj : error LNK2019: unresolved external symbol "protected: __thiscall CRectangle::CRectangle(void)" (??0CRectangle@@IAE@XZ) referenced in function "public: static class CObject * __stdcall CRectangle::CreateObject(void)" (?CreateObject@CRectangle@@SGPAVCObject@@XZ)
Elements.obj : error LNK2019: unresolved external symbol "protected: __thiscall CCircle::CCircle(void)" (??0CCircle@@IAE@XZ) referenced in function "public: static class CObject * __stdcall CCircle::CreateObject(void)" (?CreateObject@CCircle@@SGPAVCObject@@XZ)
Elements.obj : error LNK2019: unresolved external symbol "protected: __thiscall CCurve::CCurve(void)" (??0CCurve@@IAE@XZ) referenced in function "public: static class CObject * __stdcall CCurve::CreateObject(void)" (?CreateObject@CCurve@@SGPAVCObject@@XZ)
Elements.obj : error LNK2019: unresolved external symbol "protected: __thiscall CEllipse::CEllipse(void)" (??0CEllipse@@IAE@XZ) referenced in function "public: static class CObject * __stdcall CEllipse::CreateObject(void)" (?CreateObject@CEllipse@@SGPAVCObject@@XZ)
C:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\Sketcher\Debug\Sketcher.exe : fatal error LNK1120: 5 unresolved externals
Build log was saved at "file://c:\Documents and Settings\Administrator\My Documents\Visual Studio 2008\Projects\Sketcher\Sketcher\Debug\BuildLog.htm "
Sketcher - 6 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I am try to compare my sketcher with ivor's code (download from wrox website).But it's not differrent. I am not sure I am do something wrong. Anyone can help me please...
Thank for advance
Chang

chang82 December 20th, 2008 07:25 AM

Answer
 
Now I can solve that problem. Thank you for your read.

tyoung October 2nd, 2010 09:24 PM

Serialization
 
I'm having the same issue when I try to compile after adding the serilization code. Does anyone have an answer to this problem.

myassine October 29th, 2011 04:33 PM

my solution
 
I know it's too late to answer your question but I am sure someone will run into the same problem one day.
My solution to the problem was as simple as adding a constructor for each of the elements in the Elements class.
Add the following lines in the Elements.cpp file:

CLine::CLine()
{
}
CRectangle::CRectangle()
{
}
CCircle::CCircle()
{
}
CCurve::CCurve()
{
}
CEllipse::CEllipse()
{
}

For some reason when I added the constructor for the Text class I got an error that the function already has a body so just forget about the Text constructor definition.
I hope this helps
Regards,
Marwa


All times are GMT -4. The time now is 01:21 PM.

Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
2013 John Wiley & Sons, Inc.