Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Helping with including a file :D [modified]

Helping with including a file :D [modified]

Scheduled Pinned Locked Moved C / C++ / MFC
help
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mahhouraaaaaa
    wrote on last edited by
    #1

    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 like error 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

    B 1 Reply Last reply
    0
    • M Mahhouraaaaaa

      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 like error 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

      B Offline
      B Offline
      bob16972
      wrote on last edited by
      #2

      Mahhouraaaaaa 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... :)

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups