首页 > 解决方案 > 如何使用 VS2019、/std:c++latest 和 /Zc:__cplusplus 编译 eigen

问题描述

我正在尝试使用 VS2019 从 github 镜像编译 eigen 3.3.9,/std:c++latest并且/Zc:__cplusplus

我得到的是一个

eigen\Eigen\src\Core\util\Meta.h(320,25): error C2039: 'result_of': is not a member of 'std'

因为EIGEN_HAS_STD_RESULT_OF被定义。这在这里确定:

#ifndef EIGEN_HAS_STD_RESULT_OF
#if EIGEN_MAX_CPP_VER>=11 && ((__has_feature(cxx_lambdas) || (defined(__cplusplus) && __cplusplus >= 201103L)))
#define EIGEN_HAS_STD_RESULT_OF 1
#else
#define EIGEN_HAS_STD_RESULT_OF 0
#endif
#endif

从我能读到的,std::result_of在 C++20 中被删除,这没有反映在上面的检查中。

难道我做错了什么?是否有一种简单的方法可以使用 VS、C++20 和反映实际标准版本__cplusplus的定义来编译特征,而无需自己手动设置所有定义或修补 Macros.h?

标签: visual-studio-2019eigenc++20

解决方案


推荐阅读