I have three files:
TestA.cpp:
and TestB.cppCode:#include "CmnFunc.cpp"
and CmnFunc.cpp:Code:#include "CmnFunc.cpp"
Compiing with 'g++ TestA.cpp TestB.cpp' gives a multiple definition error. I thought the #ifndef bit would protect against this? Any ideas?Code:#ifndef CMNFNC #define CMNFNC int randInt(int start, int end){ ... } #endif
Thanks very much