Компилирую clang++ строчка из-за которой возникает ошибка:
std::thread t = std::thread([&] () { recvdata(ClientSocket); });
Полный вывод компилятора:
In file included from server.cpp:18:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\include\thread:11:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\include\memory:14:
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\include\xmemory:727:76: error:
call to deleted constructor of 'std::thread'
727 | ...volatile void*>(_Ptr))) _Objty(_STD forward<_Types>(_Args)...);
| ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\include\vector:798:27: note:
in instantiation of function template specialization
'std::_Default_allocator_traits<std::allocator<std::thread>>::construct<std::thread,
const std::thread &>' requested here
798 | _Alty_traits::construct(_Getal(), _Unfancy(_Mylast), _STD forward<_...
| ^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\include\vector:780:20: note:
in instantiation of function template specialization
'std::vector<std::thread>::_Emplace_back_with_unused_capacity<const std::thread
&>' requested here
780 | return _Emplace_back_with_unused_capacity(_STD forward<_Valty>(_Val)...);
| ^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\include\vector:871:9: note:
in instantiation of function template specialization
'std::vector<std::thread>::_Emplace_one_at_back<const std::thread &>' requested
here
871 | _Emplace_one_at_back(_Val);
| ^
server.cpp:157:17: note: in instantiation of member function
'std::vector<std::thread>::push_back' requested here
157 | threads.push_back(t);
| ^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\include\thread:113:5: note:
'thread' has been explicitly marked deleted here
113 | thread(const thread&) = delete;
| ^
In file included from server.cpp:19:
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\include\vector:834:23: error:
no matching member function for call to 'construct'
834 | _Alty_traits::construct(_Al, _Unfancy(_Newvec + _Whereoff), _STD forwar...
| ~~~~~~~~~~~~~~^~~~~~~~~
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\include\vector:783:17: note:
in instantiation of function template specialization
'std::vector<std::thread>::_Emplace_reallocate<const std::thread &>' requested
here
783 | return *_Emplace_reallocate(_Mylast, _STD forward<_Valty>(_Val)...);
| ^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\include\vector:871:9: note:
in instantiation of function template specialization
'std::vector<std::thread>::_Emplace_one_at_back<const std::thread &>' requested
here
871 | _Emplace_one_at_back(_Val);
| ^
server.cpp:157:17: note: in instantiation of member function
'std::vector<std::thread>::push_back' requested here
157 | threads.push_back(t);
| ^
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.39.33519\include\xmemory:723:30: note:
candidate template ignored: substitution failure [with _Objty = std::thread,
_Types = <const std::thread &>]
723 | static _CONSTEXPR20 void construct(_Alloc&, _Objty* const _Ptr, _Types&&.....
| ^
2 errors generated.