Quote Originally Posted by MacDaddy C++ View Post
There can be only one!
Do you know the HighLander??

On a more serious note, that is the whole crux of the matter. The "line of code" which defines the static and initializes it (implicitly or explicitly) must be seen by the compiler only once for all of the translation usings that will be linked into the final program.

Typically this is best done by putting the code in a specific .cpp file. And thos post does NOT contract that, nor recommend the following approach (although it is useful in certain very specific cases...

This approach should make immediate sense to anyone who has used preprocessor directives to conditionally "dllExport" / "dllImport"...

SomeFile.h
Code:
class Foo
{
    static SomeClass StaticInstance;
};
#ifdef SOME_FILE_CPP_COMPILING
Foo::StaticInstance(params);
#endof
SomeFile.cpp
Code:
#define SOME_FILE_CPP_COMPILING
#include "SomeFile.h"
This can also be accompished using the __FILE__ predefined value.

AGAIN, This is NOT recommended as a general practice. But for cases where the value of the static needs to be "published" (known to users of the header file), it provides a means that is guaranteed to remain "in sync" (A comment in the header file could easily differ from a value in an implementation file.