Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS General Discussion » Compile problem when trying to derive from CExtWA < CExtWS < CExtAFV < CFormView > > > Collapse All
Subject Author Date
Chris Holt Apr 29, 2004 - 4:55 AM

I following the example of changing my CFormView object to derive from


CExtWA < CExtWS < CExtAFV < CFormView > > >


I also changed my constructor to


CValcoWorkflowView::CValcoWorkflowView()


: CExtWA < CExtWS < CExtAFV < CFormView > > > ( CValcoWorkflowView::IDD, ((CWnd *)NULL) )


and I am getting the following errors:


Compiling...


ValcoWorkflowView.cpp


d:\Program Files\FOSS Software Inc\Prof-UIS\Include\ExtTempl.h(240) : error C2664: ’CExtAFV<CExtAFVBase>::CExtAFV(LPCTSTR,CWnd *)’ : cannot convert parameter 2 from ’UINT’ to ’LPCTSTR’


with


[


CExtAFVBase=CFormView


]


Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast


d:\Program Files\FOSS Software Inc\Prof-UIS\Include\ExtTempl.h(235) : while compiling class-template member function ’CExtWS<CExtWSBase>::CExtWS(UINT,UINT)’


with


[


CExtWSBase=CExtAFV<CFormView>


]


d:\Program Files\FOSS Software Inc\Prof-UIS\Include\ExtTempl.h(727) : see reference to class template instantiation ’CExtWS<CExtWSBase>’ being compiled


with


[


CExtWSBase=CExtAFV<CFormView>


]


d:\SourceTree\source\Valco_Dll\VLCommonUI\DocView_h\ValcoWorkflowView.h(34) : see reference to class template instantiation ’CExtWA<CExtWABase>’ being compiled


with


[


CExtWABase=CExtWS<CExtAFV<CFormView>>


]


ValcoMDIChildFrame.cpp


d:\Program Files\FOSS Software Inc\Prof-UIS\Include\ExtTempl.h(240) : error C2664: ’CExtAFV<CExtAFVBase>::CExtAFV(LPCTSTR,CWnd *)’ : cannot convert parameter 2 from ’UINT’ to ’LPCTSTR’


with


[


CExtAFVBase=CFormView


]


Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast


d:\Program Files\FOSS Software Inc\Prof-UIS\Include\ExtTempl.h(235) : while compiling class-template member function ’CExtWS<CExtWSBase>::CExtWS(UINT,UINT)’


with


[


CExtWSBase=CExtAFV<CFormView>


]


d:\Program Files\FOSS Software Inc\Prof-UIS\Include\ExtTempl.h(727) : see reference to class template instantiation ’CExtWS<CExtWSBase>’ being compiled


with


[


CExtWSBase=CExtAFV<CFormView>


]


d:\SourceTree\source\Valco_Dll\VLCommonUI\DocView_h\ValcoWorkflowView.h(34) : see reference to class template instantiation ’CExtWA<CExtWABase>’ being compiled


with


[


CExtWABase=CExtWS<CExtAFV<CFormView>>


]


ValcoImageView.cpp


d:\Program Files\FOSS Software Inc\Prof-UIS\Include\ExtTempl.h(240) : error C2664: ’CExtAFV<CExtAFVBase>::CExtAFV(LPCTSTR,CWnd *)’ : cannot convert parameter 2 from ’UINT’ to ’LPCTSTR’


with


[


CExtAFVBase=CFormView


]


Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast


d:\Program Files\FOSS Software Inc\Prof-UIS\Include\ExtTempl.h(235) : while compiling class-template member function ’CExtWS<CExtWSBase>::CExtWS(UINT,UINT)’


with


[


CExtWSBase=CExtAFV<CFormView>


]


d:\Program Files\FOSS Software Inc\Prof-UIS\Include\ExtTempl.h(727) : see reference to class template instantiation ’CExtWS<CExtWSBase>’ being compiled


with


[


CExtWSBase=CExtAFV<CFormView>


]


d:\SourceTree\source\Valco_Dll\VLCommonUI\DocView_h\ValcoWorkflowView.h(34) : see reference to class template instantiation ’CExtWA<CExtWABase>’ being compiled


with


[


CExtWABase=CExtWS<CExtAFV<CFormView>>


]


...


 


Does anybody know what these are caused by?


 


Thanks,


Chris

Chris Holt Apr 29, 2004 - 5:02 AM

Sorry the format got messed up:  The code snippets are:


CExtWA <CExtWS < CExtAFV < CFormView > > >


and


CValcoWorkflowView::CValcoWorkflowView()

: CExtWA <CExtWS < CExtAFV < CFormView > > > ( CValcoWorkflowView::IDD, ((CWnd *)NULL) )

Chris Holt Apr 29, 2004 - 5:48 AM

I found out what was causing the problem.  However, I don’t understand why.


The class I am changing is in an MFC extension DLL.  When the class has the AFX_EXT_CLASS specified to export the class this happens.  How do I get around this?


Chris

Chris Holt Apr 29, 2004 - 8:21 AM

I attempted to export the an instantiation of the template class (which is what you have to do in other circumstances when exporting classes that use templates).  I did the following:


#ifdef _AFXEXT


# define EXPIMP_TEMPLATE


#else


# define EXPIMP_TEMPLATE extern


#endif


//--------------------------------------------------------


// Need to export instantiations of template classes


// This does not create an object. It only forces the generation of all


// of the members of classes CExtWA < CExtWS < CExtAFV < CFormView > > >.


// It exports them from the DLL and imports them into the .exe file.


//--------------------------------------------------------


EXPIMP_TEMPLATE template class AFX_EXT_CLASS CExtAFV<CFormView>;


This changes the error to:


error C2512: ’CFormView’ : no appropriate default constructor available


However, this is correct.  CFormView doesn’t have a default contructor. So I’m still stuck.


Hope this helps.

Technical Support Apr 30, 2004 - 10:43 AM

Dear Chris,

We believe this problem is similar to the "exporting CStringT from DLL" problem which is described by Microsoft in this article
http://support.microsoft.com/default.aspx?scid=kb%3Ben-us%3B309801

You should perform explicit type importing from your DLL:

template class __declspec(dllimport) 
    CExtWA  <  CExtWS  <  CExtAFV  <  CFormView  > > >;