用vs2015编译okvis时遇到的代码中的语法问题

xdzhangyiy 2017-11-08 05:22:02
在windows系统中用vs2015编译okvis代码中okvis_multisensor_processing模块的时候,总是报下面的错误,自己做了小小的修改,还是不能编译通过,求c++大神给点修改的建议。
报的错误:
严重性 代码 说明 项目 文件 行
错误 C4430 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int okvis_multisensor_processing details.h 68
错误 C2143 语法错误: 缺少“,”(在“&”的前面) okvis_multisensor_processing details.h 68
错误 C2988 不可识别的模板声明/定义 okvis_multisensor_processing details.h 79
错误 C2238 意外的标记位于“;”之前 okvis_multisensor_processing details.h 79
错误 C2143 语法错误: 缺少“;”(在“&”的前面) okvis_multisensor_processing details.h 79
错误 C2059 语法错误:“&” okvis_multisensor_processing details.h 79
错误 C2334 “{”的前面有意外标记;跳过明显的函数体 okvis_multisensor_processing details.h 88
以下是details.h的代码

// This file is part of Eigen, a lightweight C++ template library
// for linear algebra.
//
// Copyright (C) 2009 Gael Guennebaud <gael.guennebaud@inria.fr>
// Copyright (C) 2009 Hauke Heibel <hauke.heibel@googlemail.com>
//
// This Source Code Form is subject to the terms of the Mozilla
// Public License v. 2.0. If a copy of the MPL was not distributed
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

#ifndef EIGEN_STL_DETAILS_H
#define EIGEN_STL_DETAILS_H

#ifndef EIGEN_ALIGNED_ALLOCATOR
#define EIGEN_ALIGNED_ALLOCATOR Eigen::aligned_allocator
#endif

namespace Eigen {

// This one is needed to prevent reimplementing the whole std::vector.
template <class T>
class aligned_allocator_indirection : public EIGEN_ALIGNED_ALLOCATOR<T>
{
public:
typedef size_t size_type;
typedef ptrdiff_t difference_type;
typedef T* pointer;
typedef const T* const_pointer;
typedef T& reference;
typedef const T& const_reference;
typedef T value_type;

template<class U>
struct rebind
{
typedef aligned_allocator_indirection<U> other;
};

aligned_allocator_indirection() {}
aligned_allocator_indirection(const aligned_allocator_indirection& ) : EIGEN_ALIGNED_ALLOCATOR<T>() {}
aligned_allocator_indirection(const EIGEN_ALIGNED_ALLOCATOR<T>& ) {}
template<class U>
aligned_allocator_indirection(const aligned_allocator_indirection<U>& ) {}
template<class U>
aligned_allocator_indirection(const EIGEN_ALIGNED_ALLOCATOR<U>& ) {}
~aligned_allocator_indirection() {}
};

#ifdef _MSC_VER

// sometimes, MSVC detects, at compile time, that the argument x
// in std::vector::resize(size_t s,T x) won't be aligned and generate an error
// even if this function is never called. Whence this little wrapper.
#define EIGEN_WORKAROUND_MSVC_STL_SUPPORT(T) \
typename Eigen::internal::conditional< \
Eigen::internal::is_arithmetic<T>::value, \
T, \
Eigen::internal::workaround_msvc_stl_support<T> \
>::type

namespace internal {
template<typename T>
struct workaround_msvc_stl_support : public T
{
workaround_msvc_stl_support() : T() {}

//inline workaround_msvc_stl_support(const T& other) : T(other) {}
workaround_msvc_stl_support(const T& other) : T(other) {}

operator T& () { return *static_cast<T*>(this); }

operator const T& () const { return *static_cast<const T*>(this); }

//template<typename OtherT>
//inline T& operator=(const OtherT& other)
//{ T::operator=(other); return *this; }

template<typename OtherT>
T& operator=(const OtherT& other)
{
T::operator=(other);
return *this;
}

//inline workaround_msvc_stl_support& operator=(const workaround_msvc_stl_support& other)
//{ T::operator=(other); return *this; }
workaround_msvc_stl_support& operator=(const workaround_msvc_stl_support& other)
{
T::operator=(other);
return *this;
}

};

}

#else

#define EIGEN_WORKAROUND_MSVC_STL_SUPPORT(T) T

#endif

}

#endif // EIGEN_STL_DETAILS_H

求大神给点解决的思路,或者有哪位大神用vs2015编译过okvis的代码,也可以交流一下,是不是我哪些库下的不对。
...全文
180 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
xdzhangyiy 2017-11-10
  • 打赏
  • 举报
回复
details.h的代码就是上面的代码,它就没有依赖其它的头文件。
greex 2017-11-09
  • 打赏
  • 举报
回复
是否有它自己的头文件没有加正确?

64,666

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧