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. Problems calling another dialog box.

Problems calling another dialog box.

Scheduled Pinned Locked Moved C / C++ / MFC
c++help
3 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.
  • A Offline
    A Offline
    Aoife
    wrote on last edited by
    #1

    Hi, I'm (attempting) to make a MFC Dialog based application. In my application I have a dialog box that calls another dialog box. Each have there own class "CDialog1" and "CDialog2". When Dialog1.cpp wants to call CDialog2 I created a private variable of CDialog2 called m_dDialog2 (in CDialog1) and in Dialog1.cpp it calls it using m_dDialog2.DoModal(). This was all working fine but now when I compile I get the following errors: c:\proj\interf\dialog1.h(18) : error C2146: syntax error : missing ';' before identifier 'm_dDialog2' c:\proj\interf\dialog1.h(18) : error C2501: 'CDialog2' : missing storage-class or type specifiers c:\proj\interf\dialog1.h(18) : error C2501: 'm_dDialog2' : missing storage-class or type specifiers I didn't make any changes myself to any of the code in dialog1.h But the strange this is that sometimes (not all the time) when I delete the variable and add it again using "Add Member Variable" it compiles and runs fine. Then after running it I compile it again (without making changes) and the three errors return. I'm getting really frustrated so any comments would be really welcome. Thanks, Aoife

    M 1 Reply Last reply
    0
    • A Aoife

      Hi, I'm (attempting) to make a MFC Dialog based application. In my application I have a dialog box that calls another dialog box. Each have there own class "CDialog1" and "CDialog2". When Dialog1.cpp wants to call CDialog2 I created a private variable of CDialog2 called m_dDialog2 (in CDialog1) and in Dialog1.cpp it calls it using m_dDialog2.DoModal(). This was all working fine but now when I compile I get the following errors: c:\proj\interf\dialog1.h(18) : error C2146: syntax error : missing ';' before identifier 'm_dDialog2' c:\proj\interf\dialog1.h(18) : error C2501: 'CDialog2' : missing storage-class or type specifiers c:\proj\interf\dialog1.h(18) : error C2501: 'm_dDialog2' : missing storage-class or type specifiers I didn't make any changes myself to any of the code in dialog1.h But the strange this is that sometimes (not all the time) when I delete the variable and add it again using "Add Member Variable" it compiles and runs fine. Then after running it I compile it again (without making changes) and the three errors return. I'm getting really frustrated so any comments would be really welcome. Thanks, Aoife

      M Offline
      M Offline
      Maxwell Chen
      wrote on last edited by
      #2

      Aoife wrote: c:\proj\interf\dialog1.h(18) : error C2146: syntax error : missing ';' before identifier 'm_dDialog2'

      #include "Dialog2.h"

      inside the dialog1.h file. Maxwell Chen No code is good code.

      A 1 Reply Last reply
      0
      • M Maxwell Chen

        Aoife wrote: c:\proj\interf\dialog1.h(18) : error C2146: syntax error : missing ';' before identifier 'm_dDialog2'

        #include "Dialog2.h"

        inside the dialog1.h file. Maxwell Chen No code is good code.

        A Offline
        A Offline
        Aoife
        wrote on last edited by
        #3

        It was already there, but when I deleated #include "Dialog2.h" and added the variable again that worked. Thanks, Aoife

        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