C++: Undefined reference to instance dans la classe Singleton

Je suis en train d'essayer de mettre en œuvre une usine comme un singleton. J'ai pratiquement utilisé l'exemple de manuel de la pattern Singleton. Voici l' .h fichier:

namespace oxygen{

class ImpFactory{

public:
    static boost::shared_ptr<ImpFactory> GetInstance();

private:
    static boost::shared_ptr<ImpFactory> mInstance;
};

et de voici le .fichier cpp:

#include "impfactory.h"

using namespace oxygen;
using namespace boost;

shared_ptr<ImpFactory> ImpFactory::GetInstance(){
    if (mInstance.get() == 0)
        mInstance = shared_ptr<ImpFactory>(new ImpFactory());
    return mInstance;
}

Le code compile, mais j'obtiens une erreur de l'éditeur de liens:

../../lib/oxygène/liboxygen..3.2.4: undefined reference to `oxygène::ImpFactory::mInstance'

Cela a actuellement trois étudiants perplexe. Des idées?

OriginalL'auteur aheld | 2010-01-27