Computing.Net > Forums > Programming > new to templates & getting link err

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

new to templates & getting link err

Reply to Message Icon

Name: Double_D
Date: November 5, 2003 at 11:45:28 Pacific
OS: WIN XP
CPU/Ram: P4 2.66/1GB
Comment:

I just started playing around with templetes. I'm getting this error and I can't figure out what I'm doing wrong. Any help would be welcomed.

Main.obj : error LNK2001: unresolved external symbol "public: __thiscall NewList<int>::~NewList<int>(void)" (??1?$NewList@H@@QAE@XZ)
Main.obj : error LNK2001: unresolved external symbol "public: __thiscall NewList<int>::NewList<int>(void)" (??0?$NewList@H@@QAE@XZ)
Debug/Main.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.

Main.exe - 3 error(s), 0 warning(s)

------------

Lists.h

#ifndef LISTS_H
#define LISTS_H

//////////////////////////////////////////////////////////////////////
//NewList Class
//////////////////////////////////////////////////////////////////////
template <class T>
class NewList
{
public:
NewList();
~NewList();

int numChoices;
T *List;
};

#endif


---------------
Lists.cpp

#include "Lists.h"

//////////////////////////////////////////////////////////////////////
//Constructor
//////////////////////////////////////////////////////////////////////
template <class T>
NewList<T>::NewList()
{
numChoices = 0;
List = 0;
}

//////////////////////////////////////////////////////////////////////
//Destructor
//////////////////////////////////////////////////////////////////////
template <class T>
NewList<T>::~NewList()
{

}

main.cpp


#include <iostream>
#include "Lists.h"
using namespace std;

//////////////////////////////////////////////////////////////////////
//Main
//////////////////////////////////////////////////////////////////////
void main()
{

NewList<int> thisList;

}




Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: new to templates & getting link err

new to proramming www.computing.net/answers/programming/new-to-proramming/721.html

New to C++ www.computing.net/answers/programming/new-to-c/8416.html

New to c++ www.computing.net/answers/programming/new-to-c/15649.html