Click here to Skip to main content
15,907,236 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Generalwindows task manager Pin
Devasish26-Jan-05 2:52
Devasish26-Jan-05 2:52 
GeneralRe: windows task manager Pin
David Crow26-Jan-05 5:58
David Crow26-Jan-05 5:58 
GeneralRe: windows task manager Pin
Blake Miller26-Jan-05 8:49
Blake Miller26-Jan-05 8:49 
GeneralADO Question Updated VC++ Pin
ivax26-Jan-05 2:50
ivax26-Jan-05 2:50 
GeneralRe: ADO Question Pin
BlackDice26-Jan-05 6:38
BlackDice26-Jan-05 6:38 
GeneralRe: ADO Question Pin
ivax27-Jan-05 1:11
ivax27-Jan-05 1:11 
Generalpdf search api Pin
Anonymous26-Jan-05 2:36
Anonymous26-Jan-05 2:36 
Generaltemplates with a nice unresolved external Pin
Ylis26-Jan-05 2:23
Ylis26-Jan-05 2:23 
I'm trying to understand templates and has therefor tried to make a linked list. The code is probably full of more errors but the one I can't seem to find now relates to an unresolved external. I don't have much experience with C++ in general so it could be something really basic. I use Visual Studio 2003 .NET and this is the code:

LList.h
<br />
#ifndef LIST_H_<br />
#define LIST_H_<br />
<br />
template< class T ><br />
class Element<br />
{<br />
public:<br />
	Element *next;<br />
	Element *previous;<br />
	T data;<br />
	void Remove();<br />
};<br />
<br />
template< class T ><br />
class LList<br />
{<br />
public:<br />
	LList();<br />
	T& operator []( int p_elem );<br />
	void Add( T p_data );<br />
protected:<br />
	int m_noElems;<br />
	Element< T > m_elements;<br />
};<br />
<br />
#endif<br />


LList.cpp
<br />
#include "list.h"<br />
<br />
template< class T > void Element< T >::Remove()<br />
{<br />
	if( this->previous != NULL )<br />
		this->previous->next = this->next;<br />
	if( this->next != NULL )<br />
		this->next->previous = this->previous;<br />
	delete this;<br />
}<br />
template< class T > LList< T >::List()<br />
{<br />
	m_noElems = 0;<br />
}<br />
<br />
template< class T > T& LList< T >::operator []( int p_elem )<br />
{<br />
	if( p_elem > m_noElems )<br />
		return NULL;<br />
	Element< T > *curEle;<br />
	for( int i = 0; i < p_elem; i++ )<br />
		curEle = m_elements.next;<br />
	return curEle->data;<br />
}<br />
<br />
template< class T > void LList< T >::Add( T p_data )<br />
{<br />
	Element< T > *curEle;<br />
	for( int i = 0: i < m_noElems; i++ )<br />
		curEle = m_elements.next;<br />
<br />
	curEle->next = new Element;<br />
	curEle->next->next = NULL;<br />
	curEle->next->previous = curEle;<br />
	curEle->next->data = p_data;<br />
	m_noElems++;<br />
}<br />


main.cpp
<br />
#include "list.h"<br />
<br />
int main()<br />
{<br />
	LList< int > test;<br />
}<br />


error:
list error LNK2019: unresolved external symbol "public: __thiscall LList<int>::LList<int>(void)" (??0?$LList@H@@QAE@XZ) referenced in function _main

Any help appriciated! Smile | :)
GeneralRe: templates with a nice unresolved external Pin
ThatsAlok26-Jan-05 2:37
ThatsAlok26-Jan-05 2:37 
GeneralRe: templates with a nice unresolved external Pin
Bob Ciora26-Jan-05 2:38
Bob Ciora26-Jan-05 2:38 
GeneralRe: templates with a nice unresolved external Pin
Ylis26-Jan-05 3:49
Ylis26-Jan-05 3:49 
GeneralRe: templates with a nice unresolved external Pin
Bob Ciora26-Jan-05 4:03
Bob Ciora26-Jan-05 4:03 
GeneralRe: templates with a nice unresolved external Pin
Nemanja Trifunovic26-Jan-05 2:53
Nemanja Trifunovic26-Jan-05 2:53 
GeneralCode completion plugin for Borland C++ Pin
Jose M Castellanos26-Jan-05 1:55
Jose M Castellanos26-Jan-05 1:55 
GeneralSNMP libraries with .NET C++ Pin
fslekesiz26-Jan-05 1:25
fslekesiz26-Jan-05 1:25 
GeneralRe: SNMP libraries with .NET C++ Pin
Antony M Kancidrowski26-Jan-05 1:57
Antony M Kancidrowski26-Jan-05 1:57 
GeneralRe: SNMP libraries with .NET C++ Pin
fslekesiz26-Jan-05 2:34
fslekesiz26-Jan-05 2:34 
GeneralRe: SNMP libraries with .NET C++ Pin
Antony M Kancidrowski26-Jan-05 3:13
Antony M Kancidrowski26-Jan-05 3:13 
QuestionHow to find the time interval accurate to millisecond? Pin
tttyip25-Jan-05 23:49
tttyip25-Jan-05 23:49 
AnswerRe: How to find the time interval accurate to millisecond? Pin
Cedric Moonen26-Jan-05 0:00
Cedric Moonen26-Jan-05 0:00 
GeneralRe: How to find the time interval accurate to millisecond? Pin
geo_m26-Jan-05 1:10
geo_m26-Jan-05 1:10 
GeneralRe: How to find the time interval accurate to millisecond? Pin
KaЯl26-Jan-05 5:38
KaЯl26-Jan-05 5:38 
GeneralRe: How to find the time interval accurate to millisecond? Pin
David Crow26-Jan-05 5:51
David Crow26-Jan-05 5:51 
GeneralRe: How to find the time interval accurate to millisecond? Pin
KaЯl26-Jan-05 6:22
KaЯl26-Jan-05 6:22 
GeneralRe: How to find the time interval accurate to millisecond? Pin
rbid26-Jan-05 10:27
rbid26-Jan-05 10:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.