Linker error undefined reference
<p>This is the error that I get
Linker error undefined reference to RationalNumber::RationalNumber(int, int)</p>

<p>I tried with Visual studio and the error says, cannot find the specified file rationalnumber.exe.</p>

<p>The Header file</p>

<pre><code>#ifndef __Assignment_2Q1__RationalNumber__
#define __Assignment_2Q1__RationalNumber__

#include &lt;iostream&gt;
using namespace std;


class RationalNumber{





public:
    RationalNumber(int=0, int=1); // prevent 0 at denominator! and reduce fraction and avoid -ive


    friend RationalNumber operator+(const RationalNumber &amp;r1,const RationalNumber &amp;r2); // need &amp; reference
    friend RationalNumber operator-(const RationalNumber &amp;r1,const RationalNumber &amp;r2);
    friend RationalNumber operator*(const RationalNumber &amp;r1,const RationalNumber &amp;r2);
    friend RationalNumber operator/(const RationalNumber &amp;r1,const RationalNumber &amp;r2);

    friend bool operator==(const RationalNumber &amp;n1,const RationalNumber &amp;n2);
    friend bool operator!=(const RationalNumber &amp;n1,const RationalNumber &amp;n2);

    friend bool operator&gt;(const RationalNumber &amp;n1,const RationalNumber &amp;n2);
    friend bool operator&lt;=(const RationalNumber &amp;n1,const RationalNumber &amp;n2);

    friend bool operator&lt;(const RationalNumber &amp;n1,const RationalNumber &amp;n2);
    friend bool operator&gt;=(const RationalNumber &amp;n1,const RationalNumber &amp;n2);

    void print();


private:

    int denominator;
    int numerator;





};






#endif /* defined(__Assignment_2Q1__RationalNumber__) */
</code></pre>

<p>The cpp file</p>

<pre><code>#include &lt;iostream&gt;
#include "RationalNumber.h"


using namespace std;

RationalNumber(int n, int d)
{
    if (d!=0&amp;&amp;d&gt;0) {
        if (d&gt;=2||d&lt;=-2) {
            float fraction1;
            float fraction2;
            fraction1= n/d;
            fraction2 = static_cast&lt;float&gt;(n)/d;

                if (fraction1==fraction2) {  // OR just simply 4/2 = 2 so n=2 , d=1!!! 
                numerator=fraction1;
                denominator=1;
                cout&lt;&lt;"You have entered a reductible fraction which reduces to! \n "&lt;&lt;numerator&lt;&lt;" / "&lt;&lt;denominator&lt;&lt;endl;
            }
                else{
                numerator=n;
                denominator=d;
                cout&lt;&lt;"You have enterd an irreductible fraction! "&lt;&lt;numerator&lt;&lt;" / "&lt;&lt;denominator&lt;&lt;endl;
            }
        }
        else
        {
            numerator=n;
            denominator=d;
            cout&lt;&lt;"The rational number is "&lt;&lt;numerator&lt;&lt;" / "&lt;&lt;denominator&lt;&lt;endl;
        }

    }
    else
        cout&lt;&lt;"The denominator cannot be 0 or a Negative number!"&lt;&lt;endl; // maybe add a set fct here

}



 RationalNumber operator+(const RationalNumber&amp; r1,const RationalNumber&amp; r2)
{
    return RationalNumber((r1.numerator+r2.denominator)/(r1.denominator+r2.denominator));

}
 RationalNumber operator-(const RationalNumber &amp;r1,const RationalNumber &amp;r2)
{
    return RationalNumber((r1.numerator-r2.denominator)/(r1.denominator-r2.denominator));

}

 RationalNumber operator*(const RationalNumber &amp;r1,const RationalNumber &amp;r2)
{
    return RationalNumber((r1.numerator*r2.denominator)/(r1.denominator*r2.denominator));
}

 RationalNumber operator/(const RationalNumber &amp;r1,const RationalNumber &amp;r2)
{
    return RationalNumber((r1.numerator/r2.denominator)/(r1.denominator/r2.denominator));

}


bool operator==(const RationalNumber &amp;n1,const RationalNumber &amp;n2)
{
    return ((n1.numerator/n1.denominator)==(n2.numerator/n2.denominator));
}

 bool operator!=(const RationalNumber &amp;n1,const RationalNumber &amp;n2)
{
    return ((n1.numerator/n1.denominator)!=(n2.numerator/n2.denominator));

}


 bool operator&gt;(const RationalNumber &amp;n1,const RationalNumber &amp;n2)
{
    return ((n1.numerator/n1.denominator)&gt;(n2.numerator/n2.denominator));

}

 bool operator&lt;=(const RationalNumber &amp;n1,const RationalNumber &amp;n2)
{
    return ((n1.numerator/n1.denominator)&lt;=(n2.numerator/n2.denominator));

}



 bool operator&lt;(const RationalNumber &amp;n1,const RationalNumber &amp;n2)
{
    return ((n1.numerator/n1.denominator)&lt;(n2.numerator/n2.denominator));

}

 bool operator&gt;=(const RationalNumber &amp;n1,const RationalNumber &amp;n2)
{
    return ((n1.numerator/n1.denominator)&gt;=(n2.numerator/n2.denominator));

}

void RationalNumber::print()
{
    cout&lt;&lt;numerator&lt;&lt;endl;
    cout&lt;&lt;denominator&lt;&lt;endl;
}
</code></pre>

<p>The main</p>

<pre><code>#include &lt;iostream&gt;
#include "RationalNumber.h"

using namespace std;

int main()

    {

        RationalNumber object1(34, 73);

        RationalNumber object2(5, 1);

        RationalNumber object3(50, 25);

        RationalNumber object4(87, 21);

        RationalNumber object5(32, 0);

        RationalNumber object6(32, -3);

        RationalNumber object7(-32, 2);

        RationalNumber object;

        object = (object1 + object2);

        object.print();

        return 0;
    }
</code></pre>
