Linker error : undefined reference to class::'methods' in C++
<p>I got a trouble while compiling the following source code
<strong>[linker error] undefined reference to 'dish::dish()'
[linker error] undefined reference to 'dish::~dish()'
[linker error] undefined reference to 'dish::ShowResult()'</strong> Can anybody help me?</p>

<p>THE HEADER FILE(dish.h):</p>

<pre><code>#ifndef DISH_H
#define DISH_H

class dish {
  public:
    dish();
    dish(std::string name, std::string variety, float caloric, float price);
    ~dish();
    static int GetN();
    void SetN(int N);
    static int IncrementN();
    std::string GetName() const;
    void SetName(std::string name);
    std::string GetVariety() const;
    void SetVariety(std::string variety);
    float GetCaloric() const;
    void SetCaloric(float caloric);
    float GetPrice() const;
    void SetPrice(float price);
    void Enter();
    void ShowResult();

  private:
    std::string name;
    std::string variety;
    float caloric;
    float price;
    static int N;

};

int dish::N;

#endif
</code></pre>

<p>and the dish.cpp:</p>

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

dish::dish()
{ 
    dish::Enter();
}

dish::dish(std::string name, std::string variety, float caloric, float price)
{
    this-&gt;name = name;
    this-&gt;variety = variety;
    this-&gt;caloric = caloric;
    this-&gt;price = price;
}

dish::~dish() 
{             
}

static int dish::GetN()
{ 
    return N; 
}

void dish::SetN(int N)
{ 
     this-&gt;N = N; 
}

static int dish::IncrementN() 
{ 
    N++; 
}

std::string dish::GetName() const 
{ 
    return name; 
}

void dish::SetName(std::string name) 
{ 
    dish::name = name; 

}

std::string dish::GetVariety() const 
{ 
    return variety;
}

void dish::SetVariety(std::string variety) 
{ 
    dish::variety = variety; 
}

float dish::GetCaloric() const 
{ 
    return caloric; 
}

void dish::SetCaloric(float caloric) 
{ 
    this-&gt;caloric = caloric; 
}

float dish::GetPrice() const 
{ 
    return price; 
}

void dish::SetPrice(float price) 
{ 
    this-&gt;price = price; 
}

void dish::Enter()
{
    std::cout &lt;&lt; "\n \\*_________________________________*\\\n"; 
    std::cout &lt;&lt; "\n   ENTER THE NAME OF DISH: ";
    getline(std::cin, name);
    std::cout &lt;&lt; "   ENTER THE VARIETY: ";
    getline(std::cin, variety);
    std::cout &lt;&lt; "   ENTER THE CALORIC CONTENT: ";
    (std::cin &gt;&gt; caloric).get();
    std::cout &lt;&lt; "   ENTER THE PRICE: ";
    (std::cin &gt;&gt; price).get();
    std::cout &lt;&lt; "\n \\*_________________________________*\\\n"; 
    dish::IncrementN();
}   

void dish::ShowResult() 
{
    std::cout &lt;&lt; "\n \\*________________________*\\\n"; 
    std::cout &lt;&lt; "\n   THE NAME OF DISH: " &lt;&lt; dish::GetName() &lt;&lt; std::endl;
    std::cout &lt;&lt; "   THE VARIETY: " &lt;&lt; dish::GetVariety() &lt;&lt; std::endl;
    std::cout &lt;&lt; "   THE CALORIC CONTENT: " &lt;&lt; dish::GetCaloric() &lt;&lt; std::endl;
    std::cout &lt;&lt; "   THE PRICE: " &lt;&lt; dish::GetPrice() &lt;&lt; std::endl;
    std::cout &lt;&lt; "\n \\*________________________*\\\n";    
}
</code></pre>

<p>Implementation in the main...</p>

<pre><code>#include &lt;cstring&gt;
using namespace std; 
#include "dish.h"


int main() {
    dish a;
    a.ShowResult();
   return 0;
} 
</code></pre>
