Issues in MFC - SDI Splitter window application

Bloqueado Issues in MFC - SDI Splitter window application

  • vendredi 24 août 2012 08:33
     
     

    Hi,

    I am writing a SDI Spliter wnd application in vc++ 6.0.  I have overrided the OnCreateClient function as follows,

    BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
    {
     // TODO: Add your specialized code here and/or call the base class

     char errorText[256];
     CException ex;
     try
     { 
      m_wndSplitter.CreateStatic(this, 1, 2, WS_CHILD | WS_VISIBLE ,AFX_IDW_PANE_FIRST);
     
     }
     catch(...)
     {
      ex.GetErrorMessage(errorText,255,0);
      MessageBox(errorText,"Exception Error",0);
     }
     try
     { 
      m_wndSplitter.CreateView(0, 0, RUNTIME_CLASS(CFormLeft), CSize(280, 100), pContext);
      m_wndSplitter.CreateView(0, 1, RUNTIME_CLASS(CFormRight), CSize(100, 100), pContext);  
     }
     catch(...)
     {
      ex.GetErrorMessage(errorText,255,0);
      MessageBox(errorText,"Exception Error",0);
     }
     
     return CMDIFrameWnd::OnCreateClient(lpcs, pContext);
    }

    But if I built it, It shows warnings as follows

    --------------------Configuration: Split2 - Win32 Debug--------------------
    Compiling...
    MainFrm.cpp
    Linking...
    LINK : warning LNK4075: ignoring /INCREMENTAL due to /FORCE specification
    FormRightCode.obj : warning LNK4006: "public: static class CObject * __stdcall CFormRight::CreateObject(void)" (?CreateObject@CFormRight@@SGPAVCObject@@XZ) already defined in FormRight.obj; second definition ignored
    FormRightCode.obj : warning LNK4006: "public: virtual struct CRuntimeClass * __thiscall CFormRight::GetRuntimeClass(void)const " (?GetRuntimeClass@CFormRight@@UBEPAUCRuntimeClass@@XZ) already defined in FormRight.obj; second definition ignored
    FormRightCode.obj : warning LNK4006: "protected: __thiscall CFormRight::CFormRight(void)" (??0CFormRight@@IAE@XZ) already defined in FormRight.obj; second definition ignored
    FormRightCode.obj : warning LNK4006: "protected: virtual __thiscall CFormRight::~CFormRight(void)" (??1CFormRight@@MAE@XZ) already defined in FormRight.obj; second definition ignored
    FormRightCode.obj : warning LNK4006: "protected: virtual void __thiscall CFormRight::DoDataExchange(class CDataExchange *)" (?DoDataExchange@CFormRight@@MAEXPAVCDataExchange@@@Z) already defined in FormRight.obj; second definition ignored
    FormRightCode.obj : warning LNK4006: "protected: virtual struct AFX_MSGMAP const * __thiscall CFormRight::GetMessageMap(void)const " (?GetMessageMap@CFormRight@@MBEPBUAFX_MSGMAP@@XZ) already defined in FormRight.obj; second definition ignored
    FormRightCode.obj : warning LNK4006: "protected: virtual void __thiscall CFormRight::AssertValid(void)const " (?AssertValid@CFormRight@@MBEXXZ) already defined in FormRight.obj; second definition ignored
    FormRightCode.obj : warning LNK4006: "protected: virtual void __thiscall CFormRight::Dump(class CDumpContext &)const " (?Dump@CFormRight@@MBEXAAVCDumpContext@@@Z) already defined in FormRight.obj; second definition ignored
    FormRightCode.obj : warning LNK4006: "protected: static struct AFX_MSGMAP const CFormRight::messageMap" (?messageMap@CFormRight@@1UAFX_MSGMAP@@B) already defined in FormRight.obj; second definition ignored
    FormRightCode.obj : warning LNK4006: "private: static struct AFX_MSGMAP_ENTRY const * const CFormRight::_messageEntries" (?_messageEntries@CFormRight@@0QBUAFX_MSGMAP_ENTRY@@B) already defined in FormRight.obj; second definition ignored
    FormRightCode.obj : warning LNK4006: "public: static struct CRuntimeClass const CFormRight::classCFormRight" (?classCFormRight@CFormRight@@2UCRuntimeClass@@B) already defined in FormRight.obj; second definition ignored
    Debug/Split2.exe : warning LNK4088: image being generated due to /FORCE option; image may not run
    Creating browse info file...

    Split2.exe - 0 error(s), 13 warning(s)

    Please some one help me to solve it.  for the mean time, I put FORCE option for development.  But even now it is working only in Debug mode not in Release Mode.

    Regards,

    Ganesan.



    Thanks & Regards, Ganesan Chandrasekaran.

Toutes les réponses

  • vendredi 24 août 2012 12:41
     
     Traitée

    The linker is finding two definitions for functions and message maps. Maybe you have things in the .h file that belong in the cpp file?  The .h file is #included in multiple places, so anything it defines gets created multiple times. If you can't figure it out show us the formright.h file.

    And remove the /FORCE command. It serves no useful purpose here.

    • Marqué comme réponse Jeevaa lundi 27 août 2012 06:20
    •  
  • lundi 27 août 2012 06:21
     
     

    Thanks Scott,

    You are right and I solved it....

    Regards,

    Ganesh.


    Thanks & Regards, Ganesan Chandrasekaran.