Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
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;
}

![]() |
![]() |
![]() |

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