I'm trying to write a linked-list type queue class with a template. My code compiles without errors or warnings, but when it links I get this:
main.o(.text+0x19): In function `main':
: undefined reference to `WaitQueue<int>::WaitQueue[in-charge]()'
main.o(.text+0x6e): In function `main':
: undefined reference to `WaitQueue<int>::push(int const&)'
main.o(.text+0x93): In function `main':
: undefined reference to `WaitQueue<int>::~WaitQueue [in-charge]()'
main.o(.text+0xb1): In function `main':
: undefined reference to `WaitQueue<int>::~WaitQueue [in-charge]()'
My code in main.cpp is
Code:
#include <iostream>
using namespace std;
#include "WaitQueue.h"
int main()
{
WaitQueue<int> wc;
int tmp;
cout << "Enter some ints (-1 to stop):" << endl;
cin >> tmp;
while (tmp != -1)
{
wc.push(tmp);
cin >> tmp;
}
return 0;
}
Does anyone know how to fix this?