You are misusing header files.
The only things that belong in header files are classes, non-intialized structs, defines, constants, prototypes, etc.
Do not put function bodies in header unless it is an inline function. The rules I follow for inlining functions are: 1. Is is short? - it doesn't do much. 2. Is it called frequently. If 1 and 2 are not true then it is not inlined.
Example:
Matrix.h
Code:
#ifndef _MATRIX_
#define _MATRIX_
#define SUCCESS 0
#define FAILURE -1
class Matrix
{
protected:
float *MyMatrix;
int numrows;
int numcols;
int sizeinbytes;
public:
Matrix(void) {};
~Matrix(void) {if (MyMatrix) delete [] MyMatrix;};
bool Init(int _numrows,int _numcols);
void Identity(void);
void Translation(float dx,float dy,float dz);
};
#endif
Matrix.cpp
Code:
#include "Matrix.h"
bool Matrix::Init(int _numrows,int _numcols)
{
//code here...
}
void Matrix::Identity(void)
{
//code here....
}
void Matrix::Translation(float dx,float dy,float dz)
{
//code here....
}