I am using visual studio 2017 and I have run across a problem. When trying to use std::gcd
it gives me an error error C2039: 'gcd': is not a member of 'std'
Here's my code:
#include "pch.h"
#include <iostream>
#include <numeric>
int main() {
std::cout << std::gcd(10, 5);
return 1;
}
std::gcd
was added in C++17. To use it in Visual Studio you need to specify the language standard. You can do that two ways, use the /std:c++17
command-line option or in the Project Properties dialog: C/C++ -> Language -> C++ Language Standard.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With