Compilation fails when smart pointer is set to static in a class

I hope that only static members are used in this tool class, instead of repeatedly initializing new objects. Compilation fails after adding static Handle(XCAFApp_Application) aXDEApp as below:

#include "XCAFDoc_DocumentTool.hxx"
#include "XCAFApp_Application.hxx"
#include "XCAFDoc_ShapeTool.hxx"
#include "Standard_Handle.hxx"
#include "TDocStd_Document.hxx"

namespace OCC {
class StepTopoHelper
{
public:
static Handle(XCAFApp_Application) aXDEApp;
static Handle(TDocStd_Document) aXDEDoc;
static Handle(XCAFDoc_ShapeTool) aXDEShapeTool;
static Handle(XCAFDoc_DimTolTool) aXDEDimTolTool;
}
}

The compiled result is:
Unresolved external symbol "public: static class opencascade::handle<class XCAFApp_Application> OCC::StepTopoHelper::aXDEApp" (?aXDEApp@StepTopoHelper@OCC@@2V?$handle@VXCAFApp_Application@@@opencascade@@A)

But when the static is removed, the compilation passes

Thanks very much

Peng Shi's picture

It was an initialization problem, my mistake