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. Did I miss something?

Did I miss something?

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpquestion
6 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.
  • J Offline
    J Offline
    jw81
    wrote on last edited by
    #1

    I declared a public variable on MainFrm.h called int m_enableD. I use #include "MainFrm.h" in my ProgramView.cpp but when I compiled it, it says "error C2065: m_enableD : undeclared identifier". Did I miss something? I usually did the same way and it works. Thanks.

    D 1 Reply Last reply
    0
    • J jw81

      I declared a public variable on MainFrm.h called int m_enableD. I use #include "MainFrm.h" in my ProgramView.cpp but when I compiled it, it says "error C2065: m_enableD : undeclared identifier". Did I miss something? I usually did the same way and it works. Thanks.

      D Offline
      D Offline
      Dreamz
      wrote on last edited by
      #2

      The error can be the way you use the m_enableD variable. Otherwise there is no problem...

      J 1 Reply Last reply
      0
      • D Dreamz

        The error can be the way you use the m_enableD variable. Otherwise there is no problem...

        J Offline
        J Offline
        jw81
        wrote on last edited by
        #3

        I use it like if(m_enableD = 0) { statement } is it ok? thanks

        D 1 Reply Last reply
        0
        • J jw81

          I use it like if(m_enableD = 0) { statement } is it ok? thanks

          D Offline
          D Offline
          Dreamz
          wrote on last edited by
          #4

          The variable is declared in CMainFrame class So you can use like this... CMainFrame *pFrame = (CMainFrame*)AfxGetMainWnd(); if(pFrame->m_enableD == 0) { //TODO }

          J 1 Reply Last reply
          0
          • D Dreamz

            The variable is declared in CMainFrame class So you can use like this... CMainFrame *pFrame = (CMainFrame*)AfxGetMainWnd(); if(pFrame->m_enableD == 0) { //TODO }

            J Offline
            J Offline
            jw81
            wrote on last edited by
            #5

            Thanks it works. I am new to VC++, could you explain why I can use other variables but not this? Thanks

            D 1 Reply Last reply
            0
            • J jw81

              Thanks it works. I am new to VC++, could you explain why I can use other variables but not this? Thanks

              D Offline
              D Offline
              Dreamz
              wrote on last edited by
              #6

              You have declared a public varibale in one class,that means you can access that varable outide the class,but only through its member varible. jw81 wrote: why I can use other variables but not this? I didn't ge exaclty what you mean... But you can direclty use a varible if it is the same class' member varible.

              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