C:/Qt/Tools/mingw730_32/lib/gcc/i686-w64-mingw32/7.3.0/include/c++/thread:288:26: error: no match for 'operator<' (operand types are 'std::thread::native_handle_type {aka ptw32_handle_t}' and 'std::thread::native_handle_type {aka ptw32_handle_t}')
return __x._M_thread < __y._M_thread;
解决方法: workaround
- Tweak the <thread> C++ header
I didn't bother to find out why, but if you run make now, compilation will fail for util.cxx with something like the following:
In file included from util.cxx:17:0:
C:/msys64/mingw64/include/c++/7.3.0/thread: In function 'bool std::operator==(std::thread::id, std::thread::id)':
C:/msys64/mingw64/include/c++/7.3.0/thread:276:26: error: no match for 'operator==' (operand types are 'std::thread::native_handle_type {aka ptw32_handle_t}' and 'std::thread::native_handle_type {aka ptw32_handle_t}')
return __x._M_thread == __y._M_thread;
~~~~~~~~~~~~~^~~~~~~~~~~~~~~
<---snip--->
In file included from util.cxx:17:0:
C:/msys64/mingw64/include/c++/7.3.0/thread: In function 'bool std::operator<(std::thread::id, std::thread::id)':
C:/msys64/mingw64/include/c++/7.3.0/thread:288:26: error: no match for 'operator<' (operand types are 'std::thread::native_handle_type {aka ptw32_handle_t}' and 'std::thread::native_handle_type {aka ptw32_handle_t}')
return __x._M_thread < __y._M_thread;
~~~~~~~~~~~~~^~~~~~~~~~~~~~
<---snip--->
The workaround is to edit the header file C:/msys64/mingw64/include/c++/7.3.0/thread. Comment out the offending functions:
// inline bool
// operator==(thread::id __x, thread::id __y) noexcept
// {
// // pthread_equal is undefined if either thread ID is not valid, so we
// // can't safely use __gthread_equal on default-constructed values (nor
// // the non-zero value returned by this_thread::get_id() for
// // single-threaded programs using GNU libc). Assume EqualityComparable.
// return __x._M_thread == __y._M_thread;
// }
inline bool
operator!=(thread::id __x, thread::id __y) noexcept
{ return !(__x == __y); }
// inline bool
// operator<(thread::id __x, thread::id __y) noexcept
// {
// // Pthreads doesn't define any way to do this, so we just have to
// // assume native_handle_type is LessThanComparable.
// return __x._M_thread < __y._M_thread;
// }
Save the changes. Remember to revert them later!
网友评论