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. beginner: program corrupted somehow?

beginner: program corrupted somehow?

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

    Hi, I was doing one of the beginning VC++ tutorials, and I added a member variable to a class by right clicking on the class name and choosing Add Member Variable from the context menu. However, I typed in the wrong name for the variable, so I wanted to delete it. There didn't seem to be a way to delete a variable using the Class Wizard, so I navigated to the variable in the header file, and I deleted it. However, when I tried to add the variable with the correct name (once again right clicking on the class name, and choosing Add Member Variable), a pop up box informed me the variable name could not be added. So, I added it by hand to the header file, as well as a few more variables, but when I went to build the project, I got 18 errors relating to the top of the .cpp file for the class. Is my only option to delete the whole program and start over? Below I included parts of the code with some comments: errors: ------------ ompiling... CodeProject_Dialog2.cpp C:\Beginning C++\CodeProject_Dialog2\CodeProject_Dialog2.cpp(11) : error C2258: illegal pure syntax, must be '= 0' C:\Beginning C++\CodeProject_Dialog2\CodeProject_Dialog2.cpp(11) : error C2252: 'THIS_FILE' : pure specifier can only be specified for functions C:\Beginning C++\CodeProject_Dialog2\CodeProject_Dialog2.cpp(17) : error C2838: illegal qualified name in member declaration C:\Beginning C++\CodeProject_Dialog2\CodeProject_Dialog2.cpp(17) : error C2059: syntax error : 'return' C:\Beginning C++\CodeProject_Dialog2\CodeProject_Dialog2.cpp(17) : error C2238: unexpected token(s) preceding ';' C:\Beginning C++\CodeProject_Dialog2\CodeProject_Dialog2.cpp(17) : error C2143: syntax error : missing ';' before '*' C:\Beginning C++\CodeProject_Dialog2\CodeProject_Dialog2.cpp(17) : error C2501: 'GetMessageMap' : missing storage-class or type specifiers C:\Beginning C++\CodeProject_Dialog2\CodeProject_Dialog2.cpp(17) : error C2556: 'int *__thiscall CCodeProject_Dialog2App::GetMessageMap(void) const' : overloaded function differs only by return type from 'const struct AFX_MSGMAP *__thiscall CCodePro ject_Dialog2App::GetMessageMap(void) const' c:\beginning c++\codeproject_dialog2\codeproject_dialog2.h(40) : see declaration of 'GetMessageMap' C:\Beginning C++\CodeProject_Dialog2\CodeProject_Dialog2.cpp(17) : error C2373: 'GetMessageMap' : redefinition; different type modifiers c:\beginning c++\codeproject_dialog2\codeproject_dialog2.h(40) : see declaration of 'GetMessageMap' C:\Beginning C++\CodeProject_Dialog2\CodeProjec

    M 1 Reply Last reply
    0
    • 7 7stud

      Hi, I was doing one of the beginning VC++ tutorials, and I added a member variable to a class by right clicking on the class name and choosing Add Member Variable from the context menu. However, I typed in the wrong name for the variable, so I wanted to delete it. There didn't seem to be a way to delete a variable using the Class Wizard, so I navigated to the variable in the header file, and I deleted it. However, when I tried to add the variable with the correct name (once again right clicking on the class name, and choosing Add Member Variable), a pop up box informed me the variable name could not be added. So, I added it by hand to the header file, as well as a few more variables, but when I went to build the project, I got 18 errors relating to the top of the .cpp file for the class. Is my only option to delete the whole program and start over? Below I included parts of the code with some comments: errors: ------------ ompiling... CodeProject_Dialog2.cpp C:\Beginning C++\CodeProject_Dialog2\CodeProject_Dialog2.cpp(11) : error C2258: illegal pure syntax, must be '= 0' C:\Beginning C++\CodeProject_Dialog2\CodeProject_Dialog2.cpp(11) : error C2252: 'THIS_FILE' : pure specifier can only be specified for functions C:\Beginning C++\CodeProject_Dialog2\CodeProject_Dialog2.cpp(17) : error C2838: illegal qualified name in member declaration C:\Beginning C++\CodeProject_Dialog2\CodeProject_Dialog2.cpp(17) : error C2059: syntax error : 'return' C:\Beginning C++\CodeProject_Dialog2\CodeProject_Dialog2.cpp(17) : error C2238: unexpected token(s) preceding ';' C:\Beginning C++\CodeProject_Dialog2\CodeProject_Dialog2.cpp(17) : error C2143: syntax error : missing ';' before '*' C:\Beginning C++\CodeProject_Dialog2\CodeProject_Dialog2.cpp(17) : error C2501: 'GetMessageMap' : missing storage-class or type specifiers C:\Beginning C++\CodeProject_Dialog2\CodeProject_Dialog2.cpp(17) : error C2556: 'int *__thiscall CCodeProject_Dialog2App::GetMessageMap(void) const' : overloaded function differs only by return type from 'const struct AFX_MSGMAP *__thiscall CCodePro ject_Dialog2App::GetMessageMap(void) const' c:\beginning c++\codeproject_dialog2\codeproject_dialog2.h(40) : see declaration of 'GetMessageMap' C:\Beginning C++\CodeProject_Dialog2\CodeProject_Dialog2.cpp(17) : error C2373: 'GetMessageMap' : redefinition; different type modifiers c:\beginning c++\codeproject_dialog2\codeproject_dialog2.h(40) : see declaration of 'GetMessageMap' C:\Beginning C++\CodeProject_Dialog2\CodeProjec

      M Offline
      M Offline
      Michael Dunn
      wrote on last edited by
      #2

      The class CCodeProject_Dialog2Dlg declaration is missing the closing }; --Mike-- Personal stuff:: Ericahist | Homepage Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ ---- You cannot truly appreciate Dilbert unless you've read it in the original Klingon.

      7 1 Reply Last reply
      0
      • M Michael Dunn

        The class CCodeProject_Dialog2Dlg declaration is missing the closing }; --Mike-- Personal stuff:: Ericahist | Homepage Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ ---- You cannot truly appreciate Dilbert unless you've read it in the original Klingon.

        7 Offline
        7 Offline
        7stud
        wrote on last edited by
        #3

        Hi, Thanks for taking the time to look over my code. I really appreciate it. Thanks to you, my program now compiles. :)

        I 1 Reply Last reply
        0
        • 7 7stud

          Hi, Thanks for taking the time to look over my code. I really appreciate it. Thanks to you, my program now compiles. :)

          I Offline
          I Offline
          IsaacLitingjun
          wrote on last edited by
          #4

          Michael is really a good guy! a man with a lot of knowledge but also be willing to help beginners! This is really a good place here! learn a lot! not only knowledge, also friendship... ^.^ Nice to see you! Have every good day! :) You will when you believe!

          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