3
votes

I am converting a existing c++ project to 64-bit version from 32-bit version. This project builds fine in 32-bit version, after converting to build for x64 platform in Configuration Manager i am getting bellow build error, are there any specific i have to inherit for 64-bit version or am i missing anything.

error C2259: 'ATL::CComObject' : cannot instantiate abstract class C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\atlmfc\include\atlcom.h

Below is the error from the output while building the project.

C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\atlmfc\include\atlcom.h(2000): error C2259: 'ATL::CComObject<Base>' : cannot instantiate abstract class
          with
          [
              Base=NAlertBand
          ]
          due to following members:
         'HRESULT IContextMenu::GetCommandString(UINT_PTR,UINT,UINT *,CHAR *,UINT)' : is abstract
          C:\Program Files (x86)\Windows Kits\8.0\Include\um\shobjidl.h(2732) : see declaration of 'IContextMenu::GetCommandString'
          C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\atlmfc\include\atlcom.h(1989) : while compiling class template member function 'HRESULT ATL::CComCreator<T1>::CreateInstance(void *,const IID &,LPVOID *)'
          with
          [
              T1=ATL::CComObject<NAlertBand>
          ]
          C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\atlmfc\include\atlcom.h(2096) : see reference to function template instantiation 'HRESULT ATL::CComCreator<T1>::CreateInstance(void *,const IID &,LPVOID *)' being compiled
          with
          [
              T1=ATL::CComObject<NAlertBand>
          ]
          C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\atlmfc\include\atlcom.h(2095) : see reference to class template instantiation 'ATL::CComCreator<T1>' being compiled
          with
          [
              T1=ATL::CComObject<NAlertBand>
          ]
          C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\atlmfc\include\atlcom.h(2091) : while compiling class template member function 'HRESULT ATL::CComCreator2<T1,T2>::CreateInstance(void *,const IID &,LPVOID *)'
          with
          [
              T1=ATL::CComCreator<ATL::CComObject<NAlertBand>>,
              T2=ATL::CComFailCreator<-2147221232>
          ]
          NAlerts.cxx(44) : see reference to function template instantiation 'HRESULT ATL::CComCreator2<T1,T2>::CreateInstance(void *,const IID &,LPVOID *)' being compiled
          with
          [
              T1=ATL::CComCreator<ATL::CComObject<NAlertBand>>,
              T2=ATL::CComFailCreator<-2147221232>
          ]
          NAlerts.cxx(44) : see reference to class template instantiation 'ATL::CComCreator2<T1,T2>' being compiled
          with
          [
              T1=ATL::CComCreator<ATL::CComObject<NAlertBand>>,
              T2=ATL::CComFailCreator<-2147221232>
          ]
  QMessage.cxx

Thanks

1
Post the part of your code that implements actual NAlertBand::GetCommandString. The problem is that its parameters do not match what they are supposed to match. In Win32 the match by incidence, and this does not happen in x64.Roman R.

1 Answers