class is not a template

I'm making a simple stack template and the compiler (g++) is complaining about the class not being a template:


hadoque@meitner:~/skola/c$ g++ -o driver driver.cpp stackTemplate.h
driver.cpp: In function ‘int main()’:
driver.cpp:9: error: ‘stackTemplate’ is not a template


class implementation:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <iostream>

using namespace std;

template <class T>
class stackTemplate
{
public:
    stackTemplate(int);
    ~stackTemplate();

private:
    T *stackArray;
    int stackSize;
    int top;
};

template <class T>
stackTemplate<T>::stackTemplate(int stackSize)
{
    top = -1;
    this->stackSize = stackSize;
    stackArray = new T[stackSize];
}


template <class T>
stackTemplate<T>::~stackTemplate()
{
  delete [] stackArray;
  stackArray = NULL;
}


driver:
1
2
3
4
5
6
7
8
9
10
#include "stackTemplate.h"

int main()
{

  stackTemplate<int> apa(10); 


 return 0;
}


Visual C++ does not produce any error with this code. Any ideas?
Topic archived. No new replies allowed.