something circular with #include?
-
I have a View class spawning a CDialog class (used the class wizard). If I include "View.h" in mydlg.h, and include "mydlg.h" in view.h, i get bizarre errors which miraculouosly disappear if I comment out the #include "view.h" from the dlg class. BUt I wanted to use that .h file to access some info from the view class in the dlg. So I tried forward declare class myView but it doesnt like that either.... Appreciate your help, ns
-
I have a View class spawning a CDialog class (used the class wizard). If I include "View.h" in mydlg.h, and include "mydlg.h" in view.h, i get bizarre errors which miraculouosly disappear if I comment out the #include "view.h" from the dlg class. BUt I wanted to use that .h file to access some info from the view class in the dlg. So I tried forward declare class myView but it doesnt like that either.... Appreciate your help, ns
In your mydlg.h, put this: class View; ( or CView, if that's it's name) Then #include it in your mydlg.cpp file. Christian NO MATTER HOW MUCH BIG IS THE WORD SIZE ,THE DATA MUCT BE TRANSPORTED INTO THE CPU. - Vinod Sharma Anonymous wrote: OK. I read a c++ book. Or...a bit of it anyway. I'm sick of that evil looking console window. I think you are a good candidate for Visual Basic. - Nemanja Trifunovic
-
I have a View class spawning a CDialog class (used the class wizard). If I include "View.h" in mydlg.h, and include "mydlg.h" in view.h, i get bizarre errors which miraculouosly disappear if I comment out the #include "view.h" from the dlg class. BUt I wanted to use that .h file to access some info from the view class in the dlg. So I tried forward declare class myView but it doesnt like that either.... Appreciate your help, ns
I think you mentioned that you already tried forward declarations, and that they didn't help. You might try putting the following line in your .h file: #pragma once Otherwise, try playing with #ifndef using the (very long) names #define'd by the class wizard: #ifndef MYDIALOG_AFX_LOTSA_STUFF_THAT_LOOKS_LIKE_A_GUID #include "mydialog.h" #endif
-
I have a View class spawning a CDialog class (used the class wizard). If I include "View.h" in mydlg.h, and include "mydlg.h" in view.h, i get bizarre errors which miraculouosly disappear if I comment out the #include "view.h" from the dlg class. BUt I wanted to use that .h file to access some info from the view class in the dlg. So I tried forward declare class myView but it doesnt like that either.... Appreciate your help, ns
Did you try prototyping ? Before you use a class into an other class you have to #include the header. If you only need a pointer to an other object, you can prototype this class. The compile knows the definition (pointer to a class) and the implementation is linked afterwards. Wimel -objectA.h- class objectA; class objectB { objectA* m_poA; } -objectB.h- class objectB; class objectA { objectB* m_poB; }