Linker Error LNK2019
<p>I have been playing around with Template functions, and made a little logger program. I have been trying to split this into header / source file, but I keep getting linker errors. I know this is simple, but I cant figure it out.</p>

<p>Also I have some convince vars in the logger header, where would be the "proper" place for those? (logStart, logEnd etc.)</p>

<p>All code below.</p>

<p><strong>Header</strong></p>

<pre><code>#ifndef __moot_logger_hpp__
#define __moot_logger_hpp__


#include &lt;iostream&gt;
#include &lt;fstream&gt;
#include &lt;string&gt;

using std::ios;

namespace Moot
{
    struct Logger
    {
        Logger();
        ~Logger() {}


        template &lt;class T&gt;      
        void saveToFile(T type);

        template &lt;typename T&gt;
        Logger&amp; operator&lt;&lt; (T type);


        /*
        Logger&amp; operator&lt;&lt; (std::wstring wideStr)
        {
            saveToFile(Moot::convertWstringToString(wideStr));
            return *this;
        }
        */
    };


    /*
    namespace {
        Logger logStart;
        Logger&amp; lStart = logStart;

        const char  logEnd = '\n';
        const char&amp; lEnd   = logEnd;

        const char  logSpace = ' ';
        const char&amp; lSpace   = logSpace;
    }
    */

}


#endif
</code></pre>

<p><strong>Source</strong></p>

<pre><code>#include &lt;Moot/logger.hpp&gt;

Moot::Logger::Logger()
{
    std::ofstream logfile;
    logfile.open ("logfile.txt", ios::trunc);
    logfile &lt;&lt; "LogFile - most recent at the bottom\n";
    logfile &lt;&lt; "-----------------------------------\n \n";
    logfile.close();
}


template &lt;typename T&gt;
void Moot::Logger::saveToFile(T type)
{
    std::ofstream logfile;
    logfile.open ("logfile.txt", ios::in | ios::app);
    logfile &lt;&lt; type;
    logfile.close();
}


template &lt;typename T&gt;
Moot::Logger&amp; Moot::Logger::operator&lt;&lt; (T type) 
{
    saveToFile(type);
    return *this;
}


/*
Logger::Logger&amp; operator&lt;&lt; (std::wstring wideStr)
{
    saveToFile(Moot::convertWstringToString(wideStr));
    return *this;
}
*/
</code></pre>

<p><strong>main</strong></p>

<pre><code>#include &lt;Moot/logger.hpp&gt;
#include &lt;iostream&gt;

int main()
{
    std::cout &lt;&lt; "hello" &lt;&lt; std::endl;

    Moot::Logger() &lt;&lt; 12;
    //Moot::lStart.saveToFile(23);
    //Moot::lStart.operator &lt;&lt; 13;

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