Hello!
I've just started coding a "Mathematics" library for my own, just to practice some OOP concepts, but sadly I didn't get too far with it before the first errors appeared. That is, I created a Matrix.H and Matrix.CPP file (separate class) in a "Linear Algebra" folder.
However, when I run the code I get the following (linker?) error:
1>------ Build started: Project: Mathematics, Configuration: Debug Win32 ------
1> Source.cpp
1>Source.obj : error LNK2019: unresolved external symbol "public: __thiscall Matrix<int>::Matrix<int>(int,int)" (??0?$Matrix@H@@QAE@HH@Z) referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol "public: int __thiscall Matrix<int>::nrRows(void)" (?nrRows@?$Matrix@H@@QAEHXZ) referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol "public: int __thiscall Matrix<int>::nrCols(void)" (?nrCols@?$Matrix@H@@QAEHXZ) referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol "public: void __thiscall Matrix<int>::insertRow(int * const,int)" (?insertRow@?$Matrix@H@@QAEXQAHH@Z) referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol "public: void __thiscall Matrix<int>::deleteRow(int)" (?deleteRow@?$Matrix@H@@QAEXH@Z) referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol "public: void __thiscall Matrix<int>::print(void)" (?print@?$Matrix@H@@QAEXXZ) referenced in function _main
1>Source.obj : error LNK2019: unresolved external symbol "public: __thiscall Matrix<int>::~Matrix<int>(void)" (??1?$Matrix@H@@QAE@XZ) referenced in function _main
1>D:\Programming 2\C++\Mathematics\Debug\Mathematics.exe : fatal error LNK1120: 7 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
#pragma once
usingnamespace std;
template <class T>
class Matrix {
private:
intstaticconst maxSizeMatrix = 1000;
int numRows;
int numCols;
T matrix[maxSizeMatrix][maxSizeMatrix];
public:
Matrix(void);
Matrix(int mNrRows, int mNrCols);
Matrix(T mMatrix[maxSizeMatrix][maxSizeMatrix], int mNrRows, int mNrCols);
int nrRows(void);
int nrCols(void);
void insertRow(T mRow[], int newRowID);
void deleteRow(int rowID);
void insertCol(T mCol[], int newColID);
void deleteCol(int colID);
// @TODO: Implement all the other methods
void print(void);
~Matrix(void);
};