title: crazy C++ compiler error messages about a copy constructor from MinGW32
body: <p>I'm a beginning C++ student and I'm using jGRASP and have installed MinGW32 because we turn our assignments remotely into a Linux machine so this helps ensure that it'll work properly by simulating a Linux environment in Windows or something. For MinGW32 I installed the "base package" and then manually selected the C++ compiler option. In jGRASP I went to <code>settings&gt;&gt;PATH/CLASSPATH&gt;&gt;workspace</code> and added a new PATH directory to <code>C:\MinGW\mingw32\bin</code> so that it'll know where the g++ compiler is.</p>
  
  <p>I get these crazy error messages upon compiling in jGRASP that I can't make much sense of. I think it has something to do with my header because of the iostream.</p>
  
  <pre><code>#include &lt;string.h&gt;
  #include &lt;iostream&gt;
  #include &lt;iomanip&gt;
  #include &lt;fstream&gt;
  using namespace std;
  </code></pre>
  
  <p>Here are the compiler error messages:</p>
  
  <pre><code>ios:42:0,
                   from c:\mingw\lib\gcc\mingw32\4.8.1\include\c++\ostream:38,
                   from c:\mingw\lib\gcc\mingw32\4.8.1\include\c++\iostream:39,
                   from lab1.cpp:6:
  c:\mingw\lib\gcc\mingw32\4.8.1\include\c++\bits\ios_base.h: In copy constructor 'std::basic_ios&lt;char&gt;::basic_ios(const std::basic_ios&lt;char&gt;&amp;)':
  ios_base.h:786:5: error: 'std::ios_base::ios_base(const std::ios_base&amp;)' is private
       ios_base(const ios_base&amp;);
       ^
  ios:44:0,
                   from c:\mingw\lib\gcc\mingw32\4.8.1\include\c++\ostream:38,
                   from c:\mingw\lib\gcc\mingw32\4.8.1\include\c++\iostream:39,
                   from lab1.cpp:6:
  basic_ios.h:66:11: error: within this context
       class basic_ios : public ios_base
             ^
  In file included from lab1.cpp:8:0:
  c:\mingw\lib\gcc\mingw32\4.8.1\include\c++\fstream: In copy constructor 'std::basic_ifstream&lt;char&gt;::basic_ifstream(const std::basic_ifstream&lt;char&gt;&amp;)':
  fstream:427:11: note: synthesized method 'std::basic_ios&lt;char&gt;::basic_ios(const std::basic_ios&lt;char&gt;&amp;)' first required here 
       class basic_ifstream : public basic_istream&lt;_CharT, _Traits&gt;
             ^
  ios:43:0,
                   from c:\mingw\lib\gcc\mingw32\4.8.1\include\c++\ostream:38,
                   from c:\mingw\lib\gcc\mingw32\4.8.1\include\c++\iostream:39,
                   from lab1.cpp:6:
  c:\mingw\lib\gcc\mingw32\4.8.1\include\c++\streambuf: In copy constructor 'std::basic_filebuf&lt;char&gt;::basic_filebuf(const std::basic_filebuf&lt;char&gt;&amp;)':
  streambuf:802:7: error: 'std::basic_streambuf&lt;_CharT, _Traits&gt;::basic_streambuf(const std::basic_streambuf&lt;_CharT, _Traits&gt;&amp;) [with _CharT = char; _Traits = std::char_traits&lt;char&gt;]' is private
         basic_streambuf(const basic_streambuf&amp; __sb)
         ^
  In file included from lab1.cpp:8:0:
  fstream:72:11: error: within this context
       class basic_filebuf : public basic_streambuf&lt;_CharT, _Traits&gt;
             ^
  c:\mingw\lib\gcc\mingw32\4.8.1\include\c++\fstream: In copy constructor 'std::basic_ifstream&lt;char&gt;::basic_ifstream(const std::basic_ifstream&lt;char&gt;&amp;)':
  fstream:427:11: note: synthesized method 'std::basic_filebuf&lt;char&gt;::basic_filebuf(const std::basic_filebuf&lt;char&gt;&amp;)' first required here 
       class basic_ifstream : public basic_istream&lt;_CharT, _Traits&gt;
  </code></pre>
  
  <p>And here is my code so far:</p>
  
  <pre><code>// ----------------------------------------------------------------------------
  // You write meaningful doxygen comments and assumptions
  
  #include &lt;string.h&gt;
  #include &lt;iostream&gt;
  #include &lt;iomanip&gt;
  #include &lt;fstream&gt;
  using namespace std;
  
  int const MAXSIZE = 100;            // maximum number of records in total
  int const MAXLENGTH = 31;           // maximum string length 
  int const MAXGRADE = 100;           // highest possible grade
  int const LOWGRADE = 0;             // lowest possible grade
  int const GROUP = 10;               // group amount
  int const HISTOGRAMSIZE = (MAXGRADE-LOWGRADE)/GROUP + 1;    // grouped by GROUP
  
  struct StudentType  {               // information of one student
     int grade;                       // the grade of the student
     char last[MAXLENGTH];            // last name (MAXLENGTH-1 at most)
     char first[MAXLENGTH];           // first name (MAXLENGTH-1 at most)
  };
  
  // prototypes go here
  bool sortInput(ifstream, StudentType, int);
  void displayList(StudentType, int);
  /*setHistrogram();
  displayHistogram();
  findAverage();*/
  
  //------------------------------- main ----------------------------------------
  int main()  {
     StudentType students[MAXSIZE];   // list of MAXSIZE number of students
     int size = 0;                    // total number of students
     int histogram[HISTOGRAMSIZE];    // grades grouped by GROUP
     int average = 0;                 // average exam score, truncated
  
     // creates file object and opens the data file
     ifstream infile("data1.txt");
     if (!infile)  { 
        cout &lt;&lt; "File could not be opened." &lt;&lt; endl; 
        return 1;  
     }
  
     // read and sort input by last then first name
     bool successfulRead = sortInput(infile, students, size);              
  
     // display list, histogram, and class average 
     if (successfulRead)  {
        displayList(students[], size);
       // setHistogram(... you figure parameters ...);
       // displayHistogram(... you figure parameters ...);
       // average = findAverage(... you figure parameters ...);
        cout &lt;&lt; "Average grade: " &lt;&lt; average &lt;&lt; endl &lt;&lt; endl;
     }
     return 0;
  }
  
  bool sortInput(ifstream infile, StudentType students[], int size)
  {
     while(infile)
     {
        StudentType temp;
        infile &gt;&gt; temp.last &gt;&gt; temp.first &gt;&gt; temp.grade;
  
        //for(int i = MAXSIZE-1; i &gt; MAXSIZE-1-size; i--)
        for(int i = size; i &gt; 0; i--)
        {
           if(strcmp(temp.last, students[i].last) &lt; 0)
           {
              //copy current name and grade down
              //strcopy(students[i+1].last, students[i].last);
              students[i+1] = students[i];
           }
           else if(strcmp(temp.last, students[i].last) == 0 &amp;&amp; strcmp(temp.first, students[i].first) &lt; 0))
           {
              //copy/assign current name and grade down
              students[i+1] = students[i];
           }
           else
           {
              //found right place, break out of loop
              break;
           }
        }
  
        //now that you've made room, insert (copy) new name into correct sorted position
        students[i] = temp;
     }
  
     return true;
  }
  
  void displayList(StudentType students[], int size)
  {
     cout &lt;&lt; "List of names sorted:" &lt;&lt; end1;
  
     for(int i = 0; i &lt; size; i++)
     {
        cout &lt;&lt; " " &lt;&lt; student[i].grade &lt;&lt; " " &lt;&lt; students[].last &lt;&lt; " " &lt;&lt; students[i].first &lt;&lt; end1;
     }
  }
  
  // ----------------------------------------------------------------------------
  // functions with meaningful doxygen comments and assumptions go here
  </code></pre>