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. Need help: fatal error C1004: unexpected end of file found

Need help: fatal error C1004: unexpected end of file found

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++
10 Posts 5 Posters 1 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.
  • B Offline
    B Offline
    bloodwinner
    wrote on last edited by
    #1

    I just want to practice class using, but met this problem: fatal error C1004: unexpected end of file found.Could anyone lend me a help,thank you! Code: // prac.cpp : Defines the entry point for the console application. #include "stdafx.h" #include "iostream" using namespace std; class polygon{ protected: int width, height; public: polygon(int,int); virtual int area () { return (0); } }; polygon::polygon(int a,int b) { width=a; height=b; } class triangle: public polygon{ public: int area(){ return(width * height/2); }; class quadrangle:public polygon{ public: int area() {return (width * height);} }; void main(int argc, char* argv[]) { quadrangle ax(10,5); triangle bx(10,5); cout << "ax area: " << ax.area() << endl; cout << "bx area: " << bx.area() << endl; }

    T J O 3 Replies Last reply
    0
    • B bloodwinner

      I just want to practice class using, but met this problem: fatal error C1004: unexpected end of file found.Could anyone lend me a help,thank you! Code: // prac.cpp : Defines the entry point for the console application. #include "stdafx.h" #include "iostream" using namespace std; class polygon{ protected: int width, height; public: polygon(int,int); virtual int area () { return (0); } }; polygon::polygon(int a,int b) { width=a; height=b; } class triangle: public polygon{ public: int area(){ return(width * height/2); }; class quadrangle:public polygon{ public: int area() {return (width * height);} }; void main(int argc, char* argv[]) { quadrangle ax(10,5); triangle bx(10,5); cout << "ax area: " << ax.area() << endl; cout << "bx area: " << bx.area() << endl; }

      T Offline
      T Offline
      toxcct
      wrote on last edited by
      #2

      this is unmanaged C++ ask the correct forum.


      TOXCCT >>> GEII power

      [VisualCalc 3.0  updated ][Flags Beginner's Guide  new! ]

      B 1 Reply Last reply
      0
      • T toxcct

        this is unmanaged C++ ask the correct forum.


        TOXCCT >>> GEII power

        [VisualCalc 3.0  updated ][Flags Beginner's Guide  new! ]

        B Offline
        B Offline
        bloodwinner
        wrote on last edited by
        #3

        sorry, what does that mean? how to solve it?

        T 1 Reply Last reply
        0
        • B bloodwinner

          sorry, what does that mean? how to solve it?

          T Offline
          T Offline
          toxcct
          wrote on last edited by
          #4

          ask the correct forum[^]...


          TOXCCT >>> GEII power

          [VisualCalc 3.0  updated ][Flags Beginner's Guide  new! ]

          N 1 Reply Last reply
          0
          • T toxcct

            ask the correct forum[^]...


            TOXCCT >>> GEII power

            [VisualCalc 3.0  updated ][Flags Beginner's Guide  new! ]

            N Offline
            N Offline
            Nish Nishant
            wrote on last edited by
            #5

            toxcct wrote:

            ask the correct forum[^]...

            Hey Tox, The thread has been moved to the unmanaged C++ forum.

            Regards, Nish


            Nish’s thoughts on MFC, C++/CLI and .NET (my blog)
            Currently working on C++/CLI in Action for Manning Publications. Also visit the Ultimate Toolbox blog (New)

            T 1 Reply Last reply
            0
            • B bloodwinner

              I just want to practice class using, but met this problem: fatal error C1004: unexpected end of file found.Could anyone lend me a help,thank you! Code: // prac.cpp : Defines the entry point for the console application. #include "stdafx.h" #include "iostream" using namespace std; class polygon{ protected: int width, height; public: polygon(int,int); virtual int area () { return (0); } }; polygon::polygon(int a,int b) { width=a; height=b; } class triangle: public polygon{ public: int area(){ return(width * height/2); }; class quadrangle:public polygon{ public: int area() {return (width * height);} }; void main(int argc, char* argv[]) { quadrangle ax(10,5); triangle bx(10,5); cout << "ax area: " << ax.area() << endl; cout << "bx area: " << bx.area() << endl; }

              J Offline
              J Offline
              Jun Du
              wrote on last edited by
              #6

              It looks that the definition of class triangle has one "}" missing.

              Best, Jun

              1 Reply Last reply
              0
              • N Nish Nishant

                toxcct wrote:

                ask the correct forum[^]...

                Hey Tox, The thread has been moved to the unmanaged C++ forum.

                Regards, Nish


                Nish’s thoughts on MFC, C++/CLI and .NET (my blog)
                Currently working on C++/CLI in Action for Manning Publications. Also visit the Ultimate Toolbox blog (New)

                T Offline
                T Offline
                toxcct
                wrote on last edited by
                #7

                it wasn't when i wrote it ;) but yup, you're right :)


                TOXCCT >>> GEII power

                [VisualCalc 3.0  updated ][Flags Beginner's Guide  new! ]

                N 1 Reply Last reply
                0
                • T toxcct

                  it wasn't when i wrote it ;) but yup, you're right :)


                  TOXCCT >>> GEII power

                  [VisualCalc 3.0  updated ][Flags Beginner's Guide  new! ]

                  N Offline
                  N Offline
                  Nish Nishant
                  wrote on last edited by
                  #8

                  toxcct wrote:

                  it wasn't when i wrote it

                  I know. In general, unless a thread changes mid-way into a managed question (or an unmanaged question) in the wrong forum, it's best to leave it for a day or two (without replying) so someone can move it to the right forum :-) Strange though that people can't even decide the correct forum to post their questions. They see the word 'C++' and bang - make their post!

                  Regards, Nish


                  Nish’s thoughts on MFC, C++/CLI and .NET (my blog)
                  Currently working on C++/CLI in Action for Manning Publications. Also visit the Ultimate Toolbox blog (New)

                  T 1 Reply Last reply
                  0
                  • B bloodwinner

                    I just want to practice class using, but met this problem: fatal error C1004: unexpected end of file found.Could anyone lend me a help,thank you! Code: // prac.cpp : Defines the entry point for the console application. #include "stdafx.h" #include "iostream" using namespace std; class polygon{ protected: int width, height; public: polygon(int,int); virtual int area () { return (0); } }; polygon::polygon(int a,int b) { width=a; height=b; } class triangle: public polygon{ public: int area(){ return(width * height/2); }; class quadrangle:public polygon{ public: int area() {return (width * height);} }; void main(int argc, char* argv[]) { quadrangle ax(10,5); triangle bx(10,5); cout << "ax area: " << ax.area() << endl; cout << "bx area: " << bx.area() << endl; }

                    O Offline
                    O Offline
                    oleg63
                    wrote on last edited by
                    #9

                    Hi, This happens when you skip somewhere closing bracket "}". Double check your source code.

                    1 Reply Last reply
                    0
                    • N Nish Nishant

                      toxcct wrote:

                      it wasn't when i wrote it

                      I know. In general, unless a thread changes mid-way into a managed question (or an unmanaged question) in the wrong forum, it's best to leave it for a day or two (without replying) so someone can move it to the right forum :-) Strange though that people can't even decide the correct forum to post their questions. They see the word 'C++' and bang - make their post!

                      Regards, Nish


                      Nish’s thoughts on MFC, C++/CLI and .NET (my blog)
                      Currently working on C++/CLI in Action for Manning Publications. Also visit the Ultimate Toolbox blog (New)

                      T Offline
                      T Offline
                      toxcct
                      wrote on last edited by
                      #10

                      i think also many people don't even know what managed C++ is (and whant managed actually means !!), and when one has a general question about C++, the fact that the main C++ forum contains "visual" in its name might tell them, "it's certainly not what i want to ask about, so, i'll go to the other C++ forum"...


                      TOXCCT >>> GEII power

                      [VisualCalc 3.0  updated ][Flags Beginner's Guide  new! ]

                      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