0

I am trying to implement a matrix class.

Class Definition

template <typename T>
class Matrix
{
private:
    int size;           //size of matrix
    T value;
    T ** M;
public:
    Matrix(int m = 2);  

Class implementation

/* Matrix constructor */
template <typename T>
Matrix<T>::Matrix(int m) : size(m), value(0)
{
    M = new T*[size];
    for (int i = 0; i < size; i++)
    {
        M[i] = new T[size];
        for (int j = 0; j < size; j++)
        {
            M[i][j] = value;
        }
    }
}

This is how I create an object:

Matrix<int> A = Matrix<int>(3);

I keep getting this error:

Error 2 error LNK2019: unresolved external symbol "public: __thiscall Matrix::Matrix(int)" (??0?$Matrix@H@@QAE@H@Z) referenced in function _main

Any ideas what can be causing this?

Samu
  • 101
  • 1
  • 7

0 Answers0