c++ - 带有 Boost 的 g++-5.1.0 是否支持 C++17?

标签 c++ boost g++ c++17

我正在尝试使用 g++-5.1.0 (2015) 编译 C++17 特定的 gcd 代码和 Boost-1.71.0Windows 7 上:

#include <numeric>

int main() {
  int x=90;
  int y=9;
  return gcd(x,y);
}

当我编译它时:

g++ gcd.cpp -IC:\Programs\boost-1.71.0\include -std=c++17

它说error: 'gcd' was not declared in this scope

如果我#include <boost/ratio/detail/mpl/gcd.hpp>这次它说 error: missing template arguments before '(' token指的是 gcd 的 (

是否 g++-5.1.0正确支持 C++17?如果是这样,如何让它正确处理 C++17代码?谢谢。

最佳答案

::mpl::gcd(x,y) 在 C++17 中不是任何东西。

我怀疑你指的是 std::gcd

此外,gcc-5.1(2015 年 4 月发布)实现 std::gcd(C++17 特性)的可能性相当低。它可以在那里实现 - 但不确定。

关于c++ - 带有 Boost 的 g++-5.1.0 是否支持 C++17?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58241484/

相关文章:

c++ - 升级到较新版本后 boost fusion/mpl 问题

linux - gnu ld 链接器行为的变化

c++ - 使用 lambda 的可变参数模板 : error with g++ but running with clang++

c++ - C++中的数组分配在具有不同长度的堆栈上

c++ - 如何在Wxwidgets中调试?

无法调用 C++ 函数

python - 动态数组和删除运算符的 boost::python 内存错误

c++ - 开放 MPI 广播延迟测量

c++ - astyle 可以处理不同的数组初始化大括号吗?

C++/命令行界面 : how to store a managed reference inside a native class?