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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. something circular with #include?

something circular with #include?

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
4 Posts 4 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.
  • N Offline
    N Offline
    ns
    wrote on last edited by
    #1

    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

    C M W 3 Replies Last reply
    0
    • N 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

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      • N 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

        M Offline
        M Offline
        Mike ONeill
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        • N 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

          W Offline
          W Offline
          wimel
          wrote on last edited by
          #4

          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; }

          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