error LNK2005 while implementing boost function pointer
<p>I am trying this piece of code</p>

<p>demo.hpp</p>

<pre><code>#include &lt;boost/function.hpp&gt;
#include &lt;boost/bind.hpp&gt;

using namespace std;

typedef boost::function&lt;int(int,int)&gt;func;

class funcPointer
{
public:

    void add_call(func);
};
</code></pre>

<p>demo.cpp</p>

<pre><code>#include &lt;iostream&gt;
#include "demo.hpp"

void funcPointer::add_call(func f)
{
    cout &lt;&lt; "Result of add: " &lt;&lt; f(5,7) &lt;&lt;endl;
}
</code></pre>

<p>main.cpp</p>

<pre><code>#include "demo.cpp"

int add(int x,int y)
{
    cout &lt;&lt; "x: " &lt;&lt; x &lt;&lt;endl;
    cout &lt;&lt; "y: " &lt;&lt; y &lt;&lt;endl;

    return x + y;
}

int main()
{
    funcPointer *fun = new funcPointer;

    fun-&gt;add_call(boost::bind(add, _1, _2));    

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

<p>while compiling I am getting the following errors:</p>

<pre><code>demo.obj : error LNK2005: "public: void __thiscall funcPointer::add_call(class boost::function&lt;int __cdecl(int,int)&gt;)" (?add_call@funcPointer@@QAEXV?$function@$$A6AHHH@Z@boost@@@Z) already defined in main.obj
E:\vs_c++\boost_func_ptr\Debug\boost_func_ptr.exe : fatal error LNK1169: one or more multiply defined symbols found
</code></pre>

<p>I don't understand what kind of error is this, Can somebody help me to solve this error??</p>