error while using winrt::implements and winrt::make

885 Views Asked by At

In C++/WinRT, I have hand-authored some classes like this (NOT using idls):

class GenericController: public winrt::Windows::Foundation::IInspectable {
...
}

class BackgroundController1: public winrt::implements<BackgroundController1, GenericController> {
...
}

And I create the object like this:

auto controller = winrt::make<BackgroundController1>();

I am getting the following errors for each of the classes which derives from winrt:implements<BackgroundControllerX, GenericController>:

Error   C3668   'winrt::impl::produce_base<D,I,void>::QueryInterface': method with override specifier 'override' did not override any base class methods    C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\cppwinrt\winrt\base.h   8016    
Error   C3668   'winrt::impl::produce_base<D,I,void>::AddRef': method with override specifier 'override' did not override any base class methods    C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\cppwinrt\winrt\base.h   8021    
Error   C3668   'winrt::impl::produce_base<D,I,void>::Release': method with override specifier 'override' did not override any base class methods   C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\cppwinrt\winrt\base.h   8026    
Error   C3668   'winrt::impl::produce_base<D,I,void>::GetIids': method with override specifier 'override' did not override any base class methods   C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\cppwinrt\winrt\base.h   8031    
Error   C3668   'winrt::impl::produce_base<D,I,void>::GetRuntimeClassName': method with override specifier 'override' did not override any base class methods   C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\cppwinrt\winrt\base.h   8036    
Error   C3609   'winrt::impl::produce_base<D,I,void>::GetTrustLevel': a 'final' function must be virtual    C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\cppwinrt\winrt\base.h   8041    
Error   C2440   'initializing': cannot convert from 'initializer list' to 'GenericController' (compiling source file C:\Users\...\BackgroundController1.cpp)    C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\cppwinrt\winrt\base.h   8814    

This is the output log:

error C3668: 'winrt::impl::produce_base<D,I,void>::QueryInterface': method with override specifier 'override' did not override any base class methods
1>        with
1>        [
1>            D=`anonymous-namespace'::BackgroundController1,
1>            I=GenericController
1>        ]
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\cppwinrt\winrt/base.h(7737): note: see reference to class template instantiation 'winrt::impl::produce_base<D,I,void>' being compiled
1>        with
1>        [
1>            D=`anonymous-namespace'::BackgroundController1,
1>            I=GenericController
1>        ]
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\cppwinrt\winrt/base.h(8005): note: see reference to class template instantiation 'winrt::impl::produce<D,I>' being compiled
1>        with
1>        [
1>            D=`anonymous-namespace'::BackgroundController1,
1>            I=GenericController
1>        ]
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\cppwinrt\winrt/base.h(7685): note: see reference to class template instantiation 'winrt::impl::producer<D,GenericController,void>' being compiled
1>        with
1>        [
1>            D=`anonymous-namespace'::BackgroundController1
1>        ]
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\cppwinrt\winrt/base.h(8829): note: see reference to class template instantiation 'winrt::impl::producers_base<D,std::tuple<GenericController>>' being compiled
1>        with
1>        [
1>            D=`anonymous-namespace'::BackgroundController1
1>        ]
1>note: see reference to class template instantiation 'winrt::implements<`anonymous-namespace'::BackgroundController1,GenericController>' being compiled
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\cppwinrt\winrt/base.h(10615): note: see reference to class template instantiation 'winrt::com_ptr<winrt::impl::IContextCallback>' being compiled
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\cppwinrt\winrt/base.h(10349): note: see reference to class template instantiation 'winrt::com_ptr<winrt::impl::IServerSecurity>' being compiled
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\cppwinrt\winrt/base.h(10308): note: see reference to class template instantiation 'std::chrono::time_point<winrt::clock,winrt::Windows::Foundation::TimeSpan>' being compiled 
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\cppwinrt\winrt/base.h(6462): note: see reference to class template instantiation 'winrt::com_ptr<winrt::impl::IMarshal>' being compiled 
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\cppwinrt\winrt/base.h(210): note: see reference to class template instantiation 'std::array<uint8_t,8>' being compiled 

Looks like there might be something wrong in the way the classes are written and the way the objects are created. But I am not able to figure out what or why.

0

There are 0 best solutions below