CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    May 1999
    Posts
    37

    Umm...Whats going on with this?

    heres the problem:

    #if !defined(AFX_MYTREECTRL_H__CE6F240E_0D3E_11D3_853B_004F490685B3__INCLUDED_)
    #define AFX_MYTREECTRL_H__CE6F240E_0D3E_11D3_853B_004F490685B3__INCLUDED_

    #include <apvector.h>
    #include "CPhysicsDBDlg.h" //simply including this file causes massive amounts of errors
    //this doesnt make sense as this is my main dlg box in my program


    #if _MSC_VER > 1000
    #pragma once
    #endif // _MSC_VER > 1000
    // MyTreeCtrl.h : header file
    //

    /////////////////////////////////////////////////////////////////////////////
    // CMyTreeCtrl window

    struct tNode
    {
    HTREEITEM NodeName;
    apvector<tNode*> SubNodes;
    apvector<CString> Q;
    apvector<CString> A;
    apvector<CString> Dum1;
    apvector<CString> Dum2;
    apvector<CString> Dum3;
    apvector<CString> Dum4;

    };

    class CMyTreeCtrl : public CTreeCtrl
    {
    // Construction
    public:
    CMyTreeCtrl();

    // Attributes
    public:

    // Operations
    public:

    // Overrides
    // ClassWizard generated virtual function overrides
    //{{AFX_VIRTUAL(CMyTreeCtrl)
    //}}AFX_VIRTUAL
    CPhysicsDBDlg * MyParent;

    // Implementation
    public:
    //CPhysicsDBDlg* MyParentWin;
    void DeleteBranch(tNode* pDelNode);

    virtual ~CMyTreeCtrl();

    // Generated message map functions
    protected:
    //{{AFX_MSG(CMyTreeCtrl)
    afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
    //}}AFX_MSG
    DECLARE_MESSAGE_MAP()
    private:
    };

    /////////////////////////////////////////////////////////////////////////////

    //{{AFX_INSERT_LOCATION}}
    // Microsoft Visual C++ will insert additional declarations immediately before the previous line.

    #endif // !defined(AFX_MYTREECTRL_H__CE6F240E_0D3E_11D3_853B_004F490685B3__INCLUDED_)




    anyone know what could cause errors by simply including a file that is compiled fine on its own and runs the program fine if it is not included in any custom made classes?
    thanks
    L5




  2. #2
    Join Date
    May 1999
    Posts
    128

    Re: Umm...Whats going on with this?

    its possible the CPhysicsDBDlg.h file contains declarations which are dependant on other include files.


  3. #3
    Join Date
    May 1999
    Posts
    128

    Re: Umm...Whats going on with this?

    wait a minute, i'm guessing you've got something like this happening...


    // in "MyTreeCtrl.h"
    class CMyTreeCtrl : public CTreeCtrl
    {
    // ...
    //
    CPhysicsDBDlg * MyParent;
    // ...
    //
    }

    // and in "PhysicsDBDlg.h"
    class CPhysicsDBDlg : public CDialog
    {
    // ...
    //
    CMyTreeCtrl m_MyTree;
    // ...
    //
    }




    if so, then you've got a sort of circular reference happening - you can't in include "MyTreeCtrl.h" without including "PhysicsDBDlg.h" before it, and you can't include "PhysicsDBDlg.h" without including "MyTreeCtrl.h" before, etc., etc. Easy fixed, forward declare one of them...


    // add this at the beginning of "MyTreeCtrl.h"
    extern class CPhysicsDBDlg;





  4. #4
    Join Date
    May 1999
    Posts
    37

    Re: Umm...Whats going on with this?

    thanks a WHOLE LOT.
    what you said...worked.
    thanks again.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured