环境:
这是代码:
#include <numeric>
...
auto g = std::gcd(10, 4);
...
我在编译命令中打开了-std=c++17
选项:
g++ -m64 -std=c++17 -c -g -w -MMD -MP -MF "build/Debug/GNU-Linux/main.o.d" -o build/Debug/GNU-Linux/main.o main.cpp
然后我得到了错误:
错误:“gcd”不是“std”的成员
从本网页开始,std::gcd
是从C++17开始引入的。
在本网页中,我的g++版本支持C++17。
但是为什么仍然有一个错误呢?在Visual 2017中,相同的代码编译时没有任何错误。
发布于 2019-02-18 12:44:08
https://stackoverflow.com/questions/54746702
复制相似问题