0

我的班级是在一个dll和一个班级中定义的,我将在其中介绍一个dll班级function template。该函数正在调用其他成员函数,但是当我编写客户端代码时,Visual Studio 编译器给了我“非模板函数”的链接错误。

这是我function templateheader

void insertMetaInformation(std::string className, char const* typeString, void* pProperty);

template <typename CLASS, typename T> 
    void RegisterMember(  std::string className, 
      std::string propertyName, 
      std::string realClassName,
      typename MemberProperty<CLASS, T>::GetterType   getFn,        
      typename MemberProperty<CLASS, T>::SetterType   setFn,
      typename MemberProperty<CLASS, int>::LengthType lenFn     = NULL, 
      typename MemberProperty<CLASS, T>::ElemLenType  elemLenFn = NULL )
    {
      MemberProperty<CLASS, T>* pProperty = new MemberProperty<CLASS, T>();
      pProperty->m_getterFn               = getFn;
      pProperty->m_setterFn               = setFn;
      pProperty->m_lenFn                  = lenFn;
      pProperty->m_elementLenFn           = elemLenFn;
      pProperty->m_propertyName           = propertyName;
      pProperty->m_realClassName          = realClassName;

      char const *typeString = ToString<T>::value();

      insertMetaInformation(className, typeString, static_cast<void*>(pProperty));
    }

我已经insertMetaInformation在一个.cpp文件中实现了。

4

0 回答 0