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. Error??

Error??

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
17 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.
  • L Offline
    L Offline
    Larsson
    wrote on last edited by
    #1

    I get this error! error C2146: syntax error : missing ';' before identifier I have Not forget ; I dont now way I get this. Is there someone hat nows way I get it??

    M 1 Reply Last reply
    0
    • L Larsson

      I get this error! error C2146: syntax error : missing ';' before identifier I have Not forget ; I dont now way I get this. Is there someone hat nows way I get it??

      M Offline
      M Offline
      Mark Salsbery
      wrote on last edited by
      #2

      Here ya go...have one of mine... ; Seriously, posting a few of the lines of code leading up to, and including, the line the error occurs on would be mucho helpful in determining the problem :)

      L 1 Reply Last reply
      0
      • M Mark Salsbery

        Here ya go...have one of mine... ; Seriously, posting a few of the lines of code leading up to, and including, the line the error occurs on would be mucho helpful in determining the problem :)

        L Offline
        L Offline
        Larsson
        wrote on last edited by
        #3

        Ok here it is, CFiles m_GetFile;

        M C 2 Replies Last reply
        0
        • L Larsson

          Ok here it is, CFiles m_GetFile;

          M Offline
          M Offline
          Mark Salsbery
          wrote on last edited by
          #4

          Is CFiles a known class (known to the compiler at that point)? If so, then the problem is in preceding line(s). Mark *EDIT* I get three errors compiling that one line: test.cpp(97) : error C2065: 'CFiles' : undeclared identifier test.cpp(97) : error C2146: syntax error : missing ';' before identifier 'm_GetFile' test.cpp(97) : error C2065: 'm_GetFile' : undeclared identifier

          L 1 Reply Last reply
          0
          • M Mark Salsbery

            Is CFiles a known class (known to the compiler at that point)? If so, then the problem is in preceding line(s). Mark *EDIT* I get three errors compiling that one line: test.cpp(97) : error C2065: 'CFiles' : undeclared identifier test.cpp(97) : error C2146: syntax error : missing ';' before identifier 'm_GetFile' test.cpp(97) : error C2065: 'm_GetFile' : undeclared identifier

            L Offline
            L Offline
            Larsson
            wrote on last edited by
            #5

            Well yes it is byt, this work in a difrent class so i dont anderstand why it dont work in this class.

            M G 2 Replies Last reply
            0
            • L Larsson

              Well yes it is byt, this work in a difrent class so i dont anderstand why it dont work in this class.

              M Offline
              M Offline
              Mark Salsbery
              wrote on last edited by
              #6

              Larsson wrote:

              this work in a difrent class so i dont anderstand why it dont work in this class.

              Maybe a missing header file? Does intellisense recognize the class at that point? Problem could be on a preceding line as well.

              L 1 Reply Last reply
              0
              • M Mark Salsbery

                Larsson wrote:

                this work in a difrent class so i dont anderstand why it dont work in this class.

                Maybe a missing header file? Does intellisense recognize the class at that point? Problem could be on a preceding line as well.

                L Offline
                L Offline
                Larsson
                wrote on last edited by
                #7

                Yes it recognize the class. byt what do you mean with = "Problem could be on a preceding line as well"?

                M 1 Reply Last reply
                0
                • L Larsson

                  Well yes it is byt, this work in a difrent class so i dont anderstand why it dont work in this class.

                  G Offline
                  G Offline
                  George L Jackson
                  wrote on last edited by
                  #8

                  You are not listening! You are missing a ";" before the line "CFiles m_GetFile;".

                  L 1 Reply Last reply
                  0
                  • G George L Jackson

                    You are not listening! You are missing a ";" before the line "CFiles m_GetFile;".

                    L Offline
                    L Offline
                    Larsson
                    wrote on last edited by
                    #9

                    Yes I do byt I have chack over and over and I dont missing any ";"

                    G 2 Replies Last reply
                    0
                    • L Larsson

                      Yes I do byt I have chack over and over and I dont missing any ";"

                      G Offline
                      G Offline
                      George L Jackson
                      wrote on last edited by
                      #10

                      I could also be a malformed line also!

                      L 1 Reply Last reply
                      0
                      • L Larsson

                        Yes it recognize the class. byt what do you mean with = "Problem could be on a preceding line as well"?

                        M Offline
                        M Offline
                        Mark Salsbery
                        wrote on last edited by
                        #11

                        What George said :) Look on lines leading up to the line the error is caught on. Somewhere, there's an unrecognized class, type, variable name, or perhaps even a line without a semi-colon.

                        1 Reply Last reply
                        0
                        • G George L Jackson

                          I could also be a malformed line also!

                          L Offline
                          L Offline
                          Larsson
                          wrote on last edited by
                          #12

                          Where should this error be in this class or in the class is about to include?

                          1 Reply Last reply
                          0
                          • L Larsson

                            Yes I do byt I have chack over and over and I dont missing any ";"

                            G Offline
                            G Offline
                            George L Jackson
                            wrote on last edited by
                            #13

                            Comment out the line and try to recompile.

                            L 1 Reply Last reply
                            0
                            • G George L Jackson

                              Comment out the line and try to recompile.

                              L Offline
                              L Offline
                              Larsson
                              wrote on last edited by
                              #14

                              Well if I do it works.

                              G 1 Reply Last reply
                              0
                              • L Larsson

                                Well if I do it works.

                                G Offline
                                G Offline
                                George L Jackson
                                wrote on last edited by
                                #15

                                Look up the erorr, C2146, via http://www.google.com/microsoft or on http://msdn.microsoft.com. It is very difficult to troubleshoot code without being able to view it. George

                                L 1 Reply Last reply
                                0
                                • G George L Jackson

                                  Look up the erorr, C2146, via http://www.google.com/microsoft or on http://msdn.microsoft.com. It is very difficult to troubleshoot code without being able to view it. George

                                  L Offline
                                  L Offline
                                  Larsson
                                  wrote on last edited by
                                  #16

                                  Trust me I have done that, that dont help me at all. If I remove CFiles m_GetFiles; Then I can compile and it works fine. I can use funktion in he class in I let it be, m_GetFiles.ReadInFile; // This work but if I compile now I get that eller. And If a compile that class I dont get any error. Im going cryase at this.

                                  1 Reply Last reply
                                  0
                                  • L Larsson

                                    Ok here it is, CFiles m_GetFile;

                                    C Offline
                                    C Offline
                                    CPallini
                                    wrote on last edited by
                                    #17

                                    Larsson wrote:

                                    CFiles m_GetFile;

                                    try

                                    CFile m_GetFile;

                                    instead.:)

                                    If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.

                                    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