我正在尝试使用 g++-5.1.0 (2015)
编译 C++17 特定的 gcd 代码和 Boost-1.71.0
在 Windows 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/