I can't understand why this code gets unresolved externals error.
stack.cpp
#include "stack.h"
#include<iostream>
using namespace std;
template<int i>
st<i>& st<i>::operator=(const st<i> &other){    
    if(this!=&other){
        delete[]anarray;
        anarray=new int[i];
        for(int i=0;i<10;i++)
            anarray[i]=other.anarray[i];}
    return *this;
    }
template<int i>
void st<i>::push(int i2, int val){anarray[i2]=val;}
stack.h
#pragma once
template<int i> 
class st{
public: int  *anarray;
    st(){anarray=new int[i];}
    ~st(){delete[]anarray;};
    st<i>& operator=(const st<i> &other);
    //int& operator[](int i);
    void push(int i, int val);
};
main.cpp
#include<iostream>
#include"stek.h"
using namespace std;
void main(){
    cout<<"----"<<endl;
    st <10> z1; st<10> z2;
    for(int i=0;i<6;i++)
    z1.anarray[i]=2*i;
    z2=z1; for(int i=0;i<6;i++) cout<<z2.anarray[i]<<endl;
    cout<<"----"<<endl;
    system("pause");
}
I know how to implement this so it works, but my question is why this particular example doesn't work.
