Helping with including a file :D [modified]
-
I want to include a header file (ServeurDicoView.h (hérited from CFormView.h) in a another class ( MySocket ) but when i put
#include "CFormView.h"
i have too many errors likeerror C2146: syntax error : missing ';' before identifier 'm_sListenSocket'
as it's explained here :// ServeurDicoView.h : interface of the CServeurDicoView class // ///////////////////////////////////////////////////////////////////////////// Mot* tabSupp[100]; //------------------ MonSocket m_sListenSocket; **// the error is here .** MonSocket m_sConnectSocket;
in the "Monsocket.h"// MonSocket.h : header file // #include "ServeurDicoView.h" // if i don't put this .h file .. i have nothing wrong in the **ServeurDicoView.h**
thanx for readin' my message .... and certainely for answering me ;) i can't compile the "Monsocket.h"... -- modified at 11:03 Wednesday 24th May, 2006 -
I want to include a header file (ServeurDicoView.h (hérited from CFormView.h) in a another class ( MySocket ) but when i put
#include "CFormView.h"
i have too many errors likeerror C2146: syntax error : missing ';' before identifier 'm_sListenSocket'
as it's explained here :// ServeurDicoView.h : interface of the CServeurDicoView class // ///////////////////////////////////////////////////////////////////////////// Mot* tabSupp[100]; //------------------ MonSocket m_sListenSocket; **// the error is here .** MonSocket m_sConnectSocket;
in the "Monsocket.h"// MonSocket.h : header file // #include "ServeurDicoView.h" // if i don't put this .h file .. i have nothing wrong in the **ServeurDicoView.h**
thanx for readin' my message .... and certainely for answering me ;) i can't compile the "Monsocket.h"... -- modified at 11:03 Wednesday 24th May, 2006Mahhouraaaaaa wrote:
#include "ServeurDicoView.h"
The view class is also dependent on the document class. If your going to couple your class to the view like this, you will also need to inclide the document class. (order of inclusion is important but I forget which one comes first). Also, it may take some jacking around with where your declarations are if they are shared by multiple classes. Sometimes forward declarations work, sometimes putting it in the stdafx.h etc... Lastly, I hate it when others say "you shouldn't do it this way" but for what it's worth, just a friendly FYI, and I still resort to this from time to time so I'm guilty of it as well, but you should try to avoid close coupling your classes to the view/doc/app classes to promote simpler reuse. Sorry. It seems to be our civic duty to point that out around here till it's pouring out of our ears. For what it's worth... :)