C Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesC Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 11th, 2003, 05:39 AM
Nille Nille is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2003
Posts: 13 Nille User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Linkage error in template

Hi everyone,
I'm trying to make a template that looks like this:

Code:
//Declaration
template <class T>
class Vector
{
private:
   T ** t;
public:
   void add(T * t);
};

//Implementation (of Vector::add)
template <class T> 
void Vector<T>::add(T * t)
{
	ensureCapacity(length + 1);
	entries[length++] = t;
}


Is there something wrong with this code? I get an "unresolved external symbol", for some reason. This is the exception:

Code:
xml error LNK2019: unresolved external symbol 
"public: void __thiscall Vector<class XMLNode>::add(class XMLNode *)" (?add@?$Vector@VXMLNode@@@@QAEXPAVXMLNode@@@Z) 
referenced in function "public: class Vector<class XMLNode> * __thiscall XMLNode::getElementsByTagName(char *)" 
(?getElementsByTagName@XMLNode@@QAEPAV?$Vector@VXMLNode@@@@PAD@Z)


I understand that the error occures in void Vector::add(T*), which is referenced by Vector<XMLNode>XMLNode::getElementsByTagName(char*), but how can I solve it?

I get stuck and easily give up when I get these errors (their kind of hard to interpret). How am I supposed to solve these?

Thanks in advance,
Nille

PS
Sorry for asking a lot of questions.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesC Programming > Linkage error in template


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT