I did compilation in VisualStudio2013 for the following code. I have a class in a layer_factory.hpp like
namespace caffe {
template <typename Dtype>
class Layer;
template <typename Dtype>
class LayerRegistry {
public:
typedef shared_ptr<Layer<Dtype> >(*Creator) (const LayerParameter&);
typedef std::map<string, Creator> CreatorRegistry;
static CreatorRegistry& Registry();
}
}
I define Registry()
in layer_factory.cpp
as
namespace caffe {
template <typename Dtype>
static LayerRegistry<Dtype>::CreatorRegistry& LayerRegistry<Dtype>::Registry()
{
static CreatorRegistry* g_registry_ = new CreatorRegistry();
return *g_registry_;
}
}
When I compile, I got errors as
Error 23 error C1903: unable to recover from previous error(s); stopping compilation C:\SOFTWARES\Visual_Studio_Workspace\caffe\src\caffe\layer_factory.cpp 23 1 caffe
Error 20 error C2065: 'Dtype' : undeclared identifier C:\SOFTWARES\Visual_Studio_Workspace\caffe\src\caffe\layer_factory.cpp 19 1 caffe
Error 19 error C2143: syntax error : missing ';' before '&' C:\SOFTWARES\Visual_Studio_Workspace\caffe\src\caffe\layer_factory.cpp 19 1 caffe
Error 22 error C2509: 'Registry' : member function not declared in 'caffe::LayerRegistry' C:\SOFTWARES\Visual_Studio_Workspace\caffe\src\caffe\layer_factory.cpp 23 1 caffe
Error 21 error C2923: 'caffe::LayerRegistry' : 'Dtype' is not a valid template type argument for parameter 'Dtype' C:\SOFTWARES\Visual_Studio_Workspace\caffe\src\caffe\layer_factory.cpp 19 1 caffe
What could be wrong with this code? Thanks