I have three files:

TestA.cpp:

Code:
#include "CmnFunc.cpp"
and TestB.cpp

Code:
#include "CmnFunc.cpp"
and CmnFunc.cpp:

Code:
#ifndef CMNFNC
#define CMNFNC

int randInt(int start, int end){

...


}

#endif
Compiing with 'g++ TestA.cpp TestB.cpp' gives a multiple definition error. I thought the #ifndef bit would protect against this? Any ideas?

Thanks very much