Implementation vs. Header File
<p>I have written my program and it works when I keep everything in the header files, and then have my main. I am now splitting them up into implementation files, but Eclipse keeps giving me errors. It gives me error at every opening brace of the constructor and functions. It says on all of them "Redefinition of (name of constructor or method), Previously declared here." What am I doing wrong, because it works in the header file?</p>

<pre><code>#include "KeyValuePair.h"

template&lt;typename Key,typename Value&gt;
KeyValuePair&lt;Key,Value&gt;::KeyValuePair()
{ // error here
}

template&lt;typename Key,typename Value&gt;
void KeyValuePair&lt;Key,Value&gt;::setPair(Key key, Value value)
{ // error here
    pairKey = key;
    pairValue = value;
}

template&lt;typename Key,typename Value&gt;
Key KeyValuePair&lt;Key,Value&gt;::getKey() const
{ // error here
    return pairKey;
}

template&lt;typename Key,typename Value&gt;
Value KeyValuePair&lt;Key,Value&gt;::getValue() const
{ // error here
    return pairValue;
}
</code></pre>

<p>Header File:</p>

<pre><code>#ifndef _KEYVALUEPAIR_H_
#define _KEYVALUEPAIR_H_

template&lt;typename Key,typename Value&gt;
class KeyValuePair
{
    private:
        Key pairKey;
        Value pairValue;

    public:
        KeyValuePair();
        void setPair(Key key,Value value);
        Key getKey() const;
        Value getValue() const;
};



#include "KeyValuePair.cpp"
#endif
</code></pre>
