i made a header file with my function declarations and the cpp file with the definitions. While making the definitions in the .cpp file i included the header and from the highlighted text the definitions seemed to match declarations in the header. In the header the the declarations were able to show where each definition is located. But when i run a test, i get error that appears to be saying the definition cant be found.
C:\Users\JAMES\programs\ClassTest-build-desktop-Qt_4_7_4_for_Desktop_-_MinGW_4_4__Qt_SDK__Debug\..\ClassTest\main.cpp:13: error: undefined reference to `fraction::addFractions(fraction)'
cpp file
#include "Jims header.h"
fraction::addFractions(fraction two)
{
int a1=_whole*_bottom+_top;
int a2=two.Whle()*two.Den()+two.Num();
int b1=one.Den();
int b2=two.Den();
int m_n1=a1*b2;
int m_n2=a2*b1;
int d=b1*b2;
int a_answer_n=m_n1+m_n2;
int a_answer_d=d;
fraction added(a_answer_n,a_answer_d);
return(added);
}
declaration in header file
class fraction{
public:
fraction addFractions(fraction two);
};