Bosma / Scheduler

Modern C++ Scheduling Library
MIT License
272 stars 74 forks source link

Error when compiling in Visual Studio Community 2019 16.8.4 #23

Open jesusdelrio opened 3 years ago

jesusdelrio commented 3 years ago

Hello!!

When compiling in Visual Studio Community 2019 16.8.4, with toolset v142, it throws the next error:

1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\include\xmemory(230,12): error C2664: 'Bosma::EveryTask::EveryTask(std::chrono::system_clock::duration,std::function<void (void)> &&,bool)': cannot convert argument 2 from '_Ty' to 'std::function<void (void)> &&'
1>        with
1>        [
1>            _Ty=std::_Binder<std::_Unforced,void (__cdecl &)(const templateData_t &,const sensorData_t &,bool),templateData_t &,sensorData_t &>
1>        ]
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\include\xmemory(228,1): message : Reason: cannot convert from '_Ty' to 'std::function<void (void)>'
1>        with
1>        [
1>            _Ty=std::_Binder<std::_Unforced,void (__cdecl &)(const templateData_t &,const sensorData_t &,bool),templateData_t &,sensorData_t &>
1>        ]
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\include\xmemory(230,33): message : No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
1>E:\Devs\NetworkTonic\Service\NTSupervisor\External libraries\scheduler\Scheduler.h(37,9): message : see declaration of 'Bosma::EveryTask::EveryTask'
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\include\memory(1563): message : see reference to function template instantiation 'void std::_Construct_in_place<_Ty,const std::chrono::system_clock::duration&,std::_Binder<std::_Unforced,void (__cdecl &)(const templateData_t &,const sensorData_t &,bool),templateData_t &,sensorData_t &>>(_Ty &,const std::chrono::system_clock::duration &,std::_Binder<std::_Unforced,void (__cdecl &)(const templateData_t &,const sensorData_t &,bool),templateData_t &,sensorData_t &> &&) noexcept(false)' being compiled
1>        with
1>        [
1>            _Ty=Bosma::EveryTask
1>        ]
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\include\memory(2207): message : see reference to function template instantiation 'std::_Ref_count_obj2<_Ty>::_Ref_count_obj2<const std::chrono::system_clock::duration&,std::_Binder<std::_Unforced,void (__cdecl &)(const templateData_t &,const sensorData_t &,bool),templateData_t &,sensorData_t &>>(const std::chrono::system_clock::duration &,std::_Binder<std::_Unforced,void (__cdecl &)(const templateData_t &,const sensorData_t &,bool),templateData_t &,sensorData_t &> &&)' being compiled
1>        with
1>        [
1>            _Ty=Bosma::EveryTask
1>        ]
1>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\include\memory(2208): message : see reference to function template instantiation 'std::_Ref_count_obj2<_Ty>::_Ref_count_obj2<const std::chrono::system_clock::duration&,std::_Binder<std::_Unforced,void (__cdecl &)(const templateData_t &,const sensorData_t &,bool),templateData_t &,sensorData_t &>>(const std::chrono::system_clock::duration &,std::_Binder<std::_Unforced,void (__cdecl &)(const templateData_t &,const sensorData_t &,bool),templateData_t &,sensorData_t &> &&)' being compiled
1>        with
1>        [
1>            _Ty=Bosma::EveryTask
1>        ]
1>E:\Devs\NetworkTonic\Service\NTSupervisor\External libraries\scheduler\Scheduler.h(132): message : see reference to function template instantiation 'std::shared_ptr<Bosma::EveryTask> std::make_shared<Bosma::EveryTask,const std::chrono::system_clock::duration&,std::_Binder<std::_Unforced,void (__cdecl &)(const templateData_t &,const sensorData_t &,bool),templateData_t &,sensorData_t &>>(const std::chrono::system_clock::duration &,std::_Binder<std::_Unforced,void (__cdecl &)(const templateData_t &,const sensorData_t &,bool),templateData_t &,sensorData_t &> &&)' being compiled
1>E:\Devs\NetworkTonic\Service\NTSupervisor\Sources\serviceController.cpp(107): message : see reference to function template instantiation 'void Bosma::Scheduler::every<void(__cdecl &)(const templateData_t &,const sensorData_t &,bool),templateData_t&,sensorData_t&>(const std::chrono::system_clock::duration,_Callable,templateData_t &,sensorData_t &)' being compiled
1>        with
1>        [
1>            _Callable=void (__cdecl &)(const templateData_t &,const sensorData_t &,bool)
1>        ]

As far I can understand, there is a problem with std::move. It was working flawlessly with previous version of VS :(

Thank you :)