Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / March 2006

Tip: Looking for answers? Try searching our database.

unresolved extern symbol on template member functions

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Eugene - 01 Mar 2006 05:19 GMT
I have just installed VC++2005 Express Ed. and I keep getting a LNK2001
error:unresolved external symbol "public: virtual void __thiscall
Circle::draw(void)const " (?draw@Circle@@UBEXXZ)
when building the following code:

class Coord {
 private:
   int x, y;
 public:
   Coord (int i1, int i2) : x(i1), y(i2) {}
};
class GeoObj {
 public:
   // draw geometric object:
   virtual void draw() const = 0;
};

// concrete geometric object class Circle
// - derived from GeoObj
class Circle : public GeoObj {
 public:
   virtual void draw() const;
};

// draw any GeoObj
void myDraw (GeoObj & obj)
{
   obj.draw();            // call draw() according to type of object
}

int main()
{
   Circle c;
   myDraw(c);            // myDraw(GeoObj&) => Circle::draw()
   return 0;
}

Thanks
Eugene
I did unsuccessfully try all the prescribed remedies. Any ideas?
Carl Daniel [VC++ MVP] - 01 Mar 2006 06:34 GMT
> I have just installed VC++2005 Express Ed. and I keep getting a
> LNK2001 error:unresolved external symbol "public: virtual void
[quoted text clipped - 36 lines]
> Eugene
> I did unsuccessfully try all the prescribed remedies. Any ideas?

Well, you haven't provided any definition for Circle::draw, so it's not
surprising that it comes up undefined at link time.  What does this have to
do with template member functions though?  There's not a single template in
the code you've posted...

-cd

PS:  virtual void draw const {} would be a definition.  What you have is
just a declaration.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.