std:thread fails compile if #include<algorithm> is used

Aug 17, 2020 at 6:27pm
Following fails compile, but works ok if I remove the <algorithm> include.

Compiler Error Message:
error: no matching function for call to ‘std::thread::thread(<unresolved overloaded function type>)’
thread t1(hi);

#include <iostream>
#include <thread>
#include <algorithm>

void hi() {
std::cout << "Hello, World" << std::endl;
}

int main() {
std::thread t1(hi);
t1.join();

return 0;
}
Aug 17, 2020 at 6:50pm
Aug 17, 2020 at 7:00pm
some compilers must be forced into modern c++ with command line options or IDE flags. By default they may attempt to use 1998 or whatever much older settings, which may not work right with some new code samples. what compiler is this, and do you know what I am talking about to try it?
Topic archived. No new replies allowed.