编译 LuaBridge 时出现错误

我尝试从仓库中编译 LuaBridge https://github.com/vinniefalco/LuaBridge/releases

但是遇到了以下错误 C2953 'luabridge::FuncTraits':类模板已被定义 LuaBridgeDemo luabridgedemo-1.0\luabridgedemo-1.0\luabridge\luabridge.h 1436

经过更详细的检查,我发现头文件中有两个类似的结构

template <typename R, typename D>
struct FuncTraits <R (*) () THROWSPEC, D>
{
  static bool const isMemberFunction = false;
  typedef D DeclType;
  typedef R ReturnType;
  typedef None Params;
  static R call (DeclType fp, TypeListValues <Params> const&)
  {
    return fp ();
  }
};


template <class T, typename R, typename D>
struct FuncTraits <R (T::*) () const THROWSPEC, D>
{
  static bool const isMemberFunction = true;
  static bool const isConstMemberFunction = true;
  typedef D DeclType;
  typedef T ClassType;
  typedef R ReturnType;
  typedef None Params;
  static R call (T const* const obj, DeclType fp, TypeListValues <Params> const&)
  {
    (void)tvl;
    return (obj->*fp)();
  }
};

我正在使用的是 Visual C++ 2015。是否有任何设置或代码更改可以解决此错误。

提前谢谢您的帮助

点赞
用户231826
用户231826

我只是删除了重复的方法签名,然后它就编译通过了。

2017-02-17 05:03:24