Compiler giving errors on iosfwd file.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • thepodest
    New Member
    • May 2007
    • 6

    Compiler giving errors on iosfwd file.

    My 1st program in C++....

    Unexpected errors come up and all to do with the header.....

    Plz help me... :(
    Attached Files
    Last edited by Banfa; May 30 '07, 11:02 AM. Reason: Removed external link, attached smaller image
  • gpraghuram
    Recognized Expert Top Contributor
    • Mar 2007
    • 1275

    #2
    HI,
    Explain the problem more clearly or post the code where u are facing the issue.

    Raghuram

    Comment

    • svlsr2000
      Recognized Expert New Member
      • Feb 2007
      • 181

      #3
      Originally posted by thepodest

      My 1st program in C++....

      Unexpected errors come up and all to do with the header.....

      Plz help me... :(
      Did u create and empty project and solution before adding your files. what are the other files in ur solution

      Comment

      • thepodest
        New Member
        • May 2007
        • 6

        #4
        That's all I got. A .cpp. That's it. And all the code is just that.

        I know C,now I want to do C++ and it's just give random errors when trying to compile. As far as I'm concerned... my code is fine... isn't that right???

        Comment

        • Banfa
          Recognized Expert Expert
          • Feb 2006
          • 9067

          #5
          In future please take the trouble to copy and paste the code and errors as text into you message rather than pasting a screen shot.

          The problem is not in your code it is in the header iosfwd which is presumably included through iostream.

          Check your compile options to make sure they are correct, pay particular attention to the precompiled header options.

          Comment

          • sicarie
            Recognized Expert Specialist
            • Nov 2006
            • 4677

            #6
            Hey guys-

            I changed the thread title to (hopefully) better describe the issue, let me know if you think it should be different.

            Comment

            • thepodest
              New Member
              • May 2007
              • 6

              #7
              Originally posted by Banfa
              In future please take the trouble to copy and paste the code and errors as text into you message rather than pasting a screen shot.

              The problem is not in your code it is in the header iosfwd which is presumably included through iostream.

              Check your compile options to make sure they are correct, pay particular attention to the precompiled header options.
              Thx, but can you be more specific??? I don't really know where to find the options.....

              The code in text

              #include <iostream>
              using namespace std;
              int main()
              {
              cout<<"Hello"<< endl;
              return 0;
              }

              Here are the error in text...

              Error 1 error C2146: syntax error : missing ';' before identifier '_Fpz' c:\program files\microsoft visual studio 8\vc\include\io sfwd 34
              Error 2 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\program files\microsoft visual studio 8\vc\include\io sfwd 34
              Error 3 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\program files\microsoft visual studio 8\vc\include\io sfwd 34
              Error 4 error C2061: syntax error : identifier 'fpos_t' c:\program files\microsoft visual studio 8\vc\include\io sfwd 50
              Error 5 error C2146: syntax error : missing ';' before identifier 'seekpos' c:\program files\microsoft visual studio 8\vc\include\io sfwd 65
              Error 6 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\program files\microsoft visual studio 8\vc\include\io sfwd 65
              Error 7 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\program files\microsoft visual studio 8\vc\include\io sfwd 66
              Warning 8 warning C4183: 'seekpos': missing return type; assumed to be a member function returning 'int' c:\program files\microsoft visual studio 8\vc\include\io sfwd 68
              Error 9 error C2146: syntax error : missing ';' before identifier '_Fpos' c:\program files\microsoft visual studio 8\vc\include\io sfwd 117
              Error 10 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\program files\microsoft visual studio 8\vc\include\io sfwd 117
              Error 11 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\program files\microsoft visual studio 8\vc\include\io sfwd 117
              Error 12 error C2065: 'EOF' : undeclared identifier c:\program files\microsoft visual studio 8\vc\include\io sfwd 510

              Thx again...

              Comment

              • svlsr2000
                Recognized Expert New Member
                • Feb 2007
                • 181

                #8
                Originally posted by thepodest
                That's all I got. A .cpp. That's it. And all the code is just that.

                I know C,now I want to do C++ and it's just give random errors when trying to compile. As far as I'm concerned... my code is fine... isn't that right???
                did u create solution and empty project for this code?

                Comment

                • thepodest
                  New Member
                  • May 2007
                  • 6

                  #9
                  Yes it's an empty project.

                  Comment

                  • Savage
                    Recognized Expert Top Contributor
                    • Feb 2007
                    • 1759

                    #10
                    Originally posted by thepodest
                    Yes it's an empty project.
                    Project->Options->Compiler tab

                    On the upper right part of the options frame u will see Pre-compiled headers

                    Savage

                    Comment

                    • thepodest
                      New Member
                      • May 2007
                      • 6

                      #11
                      What do I change it to???

                      Comment

                      • Savage
                        Recognized Expert Top Contributor
                        • Feb 2007
                        • 1759

                        #12
                        Originally posted by thepodest
                        What do I change it to???
                        What's currently selected?

                        Savage

                        Comment

                        • thepodest
                          New Member
                          • May 2007
                          • 6

                          #13
                          It's "Non Using Precompiled Headers" There are options..... Create precompiled headers, Use precompiled headers, <inherit from parent or project default>

                          Which one do I select?

                          Comment

                          • weaknessforcats
                            Recognized Expert Expert
                            • Mar 2007
                            • 9214

                            #14
                            There are no bugs in your code.

                            Did you do this:
                            1) Create a C++ Win32 Project
                            2) When rthe wizard appeared you did not click Finish but instead clicked Application Settings
                            3) then you selected a) console application and b) empty project
                            4) then you clicked Finish.
                            5) then you ADDED a .cpp file to the project

                            If you didn't do this exactly, your project and .cpp file are not set up correctly.

                            Be sure you didn't confuse C++ with C#.

                            Normally, you don't get a .cpp file by creating a project. You create a project and then ADD a cpp file to the project.

                            Your attachment does not show the Solution Explorer so I can't tell if the .cpp file is part of your project.

                            Comment

                            • svlsr2000
                              Recognized Expert New Member
                              • Feb 2007
                              • 181

                              #15
                              Please check this link from msdn. This might help you to create a new project and solution / workspace for your .cpp file

                              Comment

                              Working...