Hi, I'm getting pretty frustrated with my code at this point, Im trying to implement a queue class to hold a number of integers... however dev (the compiler im using) keeps spitting out the errors
[Linker error] undefined reference to `QueueType<int>::QueueType()'
[Linker error] undefined reference to `QueueType<int>::~QueueType()'
here is the line of code of interest
{
QueueType<int> queue;
}
the implementation
#include <stdlib.h>
#include <stdio.h>
#include <iostream>
#include <math.h>
using namespace std;
#include "queue.h"
#include "image.h"
(image.cpp is where im calling this function from)
the queue.h
#ifndef QUEUE_H
#define QUEUE_H
template<class ItemType>
class QueueType
{
public:
QueueType();
~QueueType();
void MakeEmpty();
bool IsEmpty() const;
bool IsFull() const;
void Enqueue(ItemType);
void Dequeue(ItemType&);
private:
int front, rear,max;
ItemType items;
int maxQ;
};
#endif
and the queue.cpp (constructor and destructor)
#include <iostream>
#include <fstream>
using namespace std;
#include "queue.h"
template <class ItemType>
QueueType<ItemType>::QueueType()
{
max=20;
maxQ=max+1;
front=maxQ-1;
rear=maxQ-1;
items= new ItemType[maxQ];
}
template <class ItemType>
QueueType<ItemType>::~QueueType()
{
delete [] items;
}
I have already hit recompile all but Ive received the same error
any help would be appreciated