Matrix class and some compiling error

Hey there, Im getting an error when compiling the following code and I would like to know where does it come from. Basically, Im starting to create my own matrix class, and apart from it, I'm creating another .cpp file which will contain all operations between matrices, like this one for addition
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
 #include<iostream>
#include<cmath>
#include<fstream>
#include "matrix.h"

using namespace std;
//Sum of matrices

matrix msum(matrix A, matrix B){
	
	int n,m;
	n=A.nrows();
	m=A.ncolumns();
	
	matrix S(n,m);
			
	for(int i=0;i<n;i++){
	  for(int j=0;j<m;j++){
	  	
	  	S.get(i,j)=A.get(i,j)+B.get(i,j);
	  }		
	}
	
	
	return S;
}

Here get is a function acting over the matrix class that takes the (i,j) element, returning its value. When I include that .cpp file in the header of the "main.cpp" file, I get an error saying that there is "multiple definition of msum(int,int) ". Any ideas on this? Thanks!
Do not include one cpp file in another cpp file. Just include the header file.
Topic archived. No new replies allowed.