Confused Why I am getting C1010 error?
<p>I have three files:
Main, slist.h and slist.cpp can be seen at <a href="http://forums.devarticles.com/c-c-help-52/confused-why-i-am-getting-c2143-and-c1010-error-259574.html" rel="nofollow">http://forums.devarticles.com/c-c-help-52/confused-why-i-am-getting-c2143-and-c1010-error-259574.html</a> </p>

<p>I'm trying to make a program where main reads the list of student names from a file (roster.txt) and inserts all the names in a list in ascending order. This is the full class roster list (notCheckedIN). From here I will read all students who have come to write the exams, each checkin will transfer their name to another list (in ascending order) called present.</p>

<p>The final product is 
notCheckedIN will contain a list of all those students that did not write the exam and
present will contain the list of all students who wrote the exam</p>

<p>Main File:</p>

<pre><code>// Exam.cpp : Defines the entry point for the console application.
#include "stdafx.h"
#include "iostream"
#include "iomanip"
#include "fstream"
#include "string"
#include "slist.h"

using namespace std;

void OpenFile(ifstream&amp;);
void GetClassRoster(SortList&amp;, ifstream&amp;);
void InputStuName(SortList&amp;, SortList&amp;);
void UpdateList(SortList&amp;, SortList&amp;, string);
void Print(SortList&amp;, SortList&amp;);
const string END_DATA = "EndData";

int main()
{

ifstream roster;
SortList notCheckedIn; //students present
SortList present; //student absent

OpenFile(roster);
if(!roster) //Make sure file is opened
return 1;
GetClassRoster(notCheckedIn, roster); //insert the roster list into the notCheckedIn list
InputStuName(present, notCheckedIn);
Print(present, notCheckedIn);
return 0;
}

void OpenFile(ifstream&amp; roster)
//Precondition: roster is pointing to file containing student anmes
//Postcondition:IF file does not exist -&gt; exit
{
string fileName = "roster.txt";
roster.open(fileName.c_str());

if(!roster)
cout &lt;&lt; "***ERROR CANNOT OPEN FILE :"&lt;&lt; fileName &lt;&lt; "***" &lt;&lt; endl;
}
void GetClassRoster(SortList&amp; notCheckedIN, ifstream&amp; roster)
//Precondition:roster points to file containing list of student last name
// &amp;&amp; notCheckedIN is empty
//Postcondition:notCheckedIN is filled with the names taken from roster.txt in ascending order
{
string name;
roster &gt;&gt; name;
while(roster)
{
notCheckedIN.Insert(name);
roster &gt;&gt; name;
}
}
void InputStuName(SortList&amp; present, SortList&amp; notCheckedIN)
//Precondition: present list is empty initially and notCheckedIN list is full
//Postcondition: repeated prompting to enter stuName
// &amp;&amp; notCheckedIN will delete all names found in present
// &amp;&amp; present will contain names present
// &amp;&amp; names not found in notCheckedIN will report Error
{
string stuName;

cout &lt;&lt; "Enter last name (Enter EndData if none to Enter): ";
cin &gt;&gt; stuName;
while(stuName!=END_DATA)
{
UpdateList(present, notCheckedIN, stuName);
}
}
void UpdateList(SortList&amp; present, SortList&amp; notCheckedIN, string stuName)
//Precondition:stuName is assigned
//Postcondition:IF stuName is present, stuName is inserted in present list
// &amp;&amp; stuName is removed from the notCheckedIN list
// ELSE stuName does not exist
{
if(notCheckedIN.isPresent(stuName))
{
present.Insert(stuName);
notCheckedIN.Delete(stuName);
}
else
cout &lt;&lt; "NAME IS NOT PRESENT" &lt;&lt; endl;
}
void Print(SortList&amp; present, SortList&amp; notCheckedIN)
//Precondition: present and notCheckedIN contains a list of student Names present/not present
//Postcondition: content of present and notCheckedIN is printed
{
cout &lt;&lt; "Candidates Present" &lt;&lt; endl;
present.Print();

cout &lt;&lt; "Candidates Absent" &lt;&lt; endl;
notCheckedIN.Print();
}
</code></pre>

<p>Header File:</p>

<pre><code>//Specification File: slist.h
//This file gives the specifications of a list abstract data type
//List items inserted will be in order
//Class SortList, structured type used to represent an ADT
using namespace std;
const int MAX_LENGTH = 200;
typedef string ItemType;
//Class Object (class instance) SortList. Variable of class type.
class SortList
{
//Class Member - components of a class, can be either data or functions
public:
//Constructor
//Post-condition: Empty list is created
SortList();

//Const member function. Compiler error occurs if any statement within tries to modify a private data
bool isEmpty() const;
//Post-condition: == true if list is empty
// == false if list is not empty

bool isFull() const;
//Post-condition: == true if list is full
// == false if list is full

int Length() const;
//Post-condition: size of list

void Insert(ItemType item);
//Precondition: NOT isFull() &amp;&amp; item is assigned
//Postcondition: item is in list &amp;&amp; Length() = Length()@entry + 1

void Delete(ItemType item);
//Precondition: NOT isEmpty() &amp;&amp; item is assigned
//Postcondition:
// IF items is in list at entry
// first occurance of item in list is removed
// &amp;&amp; Length() = Length()@entry -1;
// ELSE
// list is not changed

bool isPresent(ItemType item) const;
//Precondition: item is assigned
//Postcondition: == true if item is present in list
// == false if item is not present in list

void Print() const;
//Postcondition: All component of list have been output
private:
int length;
ItemType data[MAX_LENGTH];
void BinSearch(ItemType, bool&amp;, int&amp;) const;

};
</code></pre>

<p>Source File:</p>

<pre><code>//Implementation File: slist.cpp
//This file gives the specifications of a list abstract data type
//List items inserted will be in order
//Class SortList, structured type used to represent an ADT
#include "iostream"
#include "slist.h"

using namespace std;
// int length;
// ItemType data[MAX_SIZE];
//Class Object (class instance) SortList. Variable of class type.
SortList::SortList()
//Constructor
//Post-condition: Empty list is created
{
length=0;
}

//Const member function. Compiler error occurs if any statement within tries to modify a private data
bool SortList::isEmpty() const
//Post-condition: == true if list is empty
// == false if list is not empty
{
return(length==0);
}

bool SortList::isFull() const
//Post-condition: == true if list is full
// == false if list is full
{
return (length==(MAX_LENGTH-1));
}

int SortList::Length() const
//Post-condition: size of list
{
return length;
}

void SortList::Insert(ItemType item)
//Precondition: NOT isFull() &amp;&amp; item is assigned
//Postcondition: item is in list &amp;&amp; Length() = Length()@entry + 1
// &amp;&amp; list componenet are in ascending order of value
{
int index;
index = length -1;
while(index &gt;=0 &amp;&amp; item&lt;data[index])
{
data[index+1]=data[index];
index--;
}
data[index+1]=item;
length++;
}

void SortList:elete(ItemType item)
//Precondition: NOT isEmpty() &amp;&amp; item is assigned
//Postcondition:
// IF items is in list at entry
// first occurance of item in list is removed
// &amp;&amp; Length() = Length()@entry -1;
// &amp;&amp; list components are in ascending order
// ELSE data array is unchanged
{
bool found;
int position;

BinSearch(item,found,position);

if (found)
{
for(int index = position; index &lt; length; index++)
data[index]=data[index+1];
length--;
}
}

bool SortList::isPresent(ItemType item) const
//Precondition: item is assigned &amp;&amp; length &lt;= MAX_LENGTH &amp;&amp; items are in ascending order
//Postcondition: true if item is found in the list
// false if item is not found in the list
{
bool found;
int position;

BinSearch(item,found,position);
return (found);
}

void SortList::Print() const
//Postcondition: All component of list have been output
{
for(int x= 0; x&lt;length; x++)
cout &lt;&lt; data[x] &lt;&lt; endl;
}

void SortList::BinSearch(ItemType item, bool found, int position) const
//Precondition: item contains item to be found
// &amp;&amp; item in the list is an ascending order
//Postcondition: IF item is in list, position is returned
// ELSE item does not exist in the list
{
int first = 0;
int last = length -1;
int middle;

found = false;
while(!found)
{
middle = (first+last)/2;
if(data[middle]&lt;item)
first = middle+1;
else if (data[middle] &gt; item)
last = middle -1;
else
found = true;
}
if(found)
position = middle;
}
</code></pre>

<p>I cannot get rid of the C1010 error:
fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source?</p>

<p>Is there a way to get rid of this error?
When I included "stdafx.h" I received the following 32 errors (which does not make sense to me why because I referred back to my manual on how to use Class method - everything looks a.ok.)</p>

<pre><code>Error 1 error C2871: 'std' : a namespace with this name does not exist c:\..\slist.h 6
Error 2 error C2146: syntax error : missing ';' before identifier 'ItemType' c:\..\slist.h 8
Error 3 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\..\slist.h 8
Error 4 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\..\slist.h 8
Error 5 error C2061: syntax error : identifier 'ItemType' c:\..\slist.h 30
Error 6 error C2061: syntax error : identifier 'ItemType' c:\..\slist.h 34
Error 7 error C2061: syntax error : identifier 'ItemType' c:\..\slist.h 43
Error 8 error C2146: syntax error : missing ';' before identifier 'data' c:\..\slist.h 52
Error 9 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\..\slist.h 52
Error 10 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\..\slist.h 52
Error 11 error C2061: syntax error : identifier 'ItemType' c:\..\slist.h 53
Error 12 error C2146: syntax error : missing ')' before identifier 'item' c:\..\slist.cpp 41
Error 13 error C2761: 'void SortList::Insert(void)' : member function redeclaration not allowed c:\..\slist.cpp 41
Error 14 error C2059: syntax error : ')' c:\..\slist.cpp 41
Error 15 error C2143: syntax error : missing ';' before '{' c:\..\slist.cpp 45
Error 16 error C2447: '{' : missing function header (old-style formal list?) c:\..\slist.cpp 45
Error 17 error C2146: syntax error : missing ')' before identifier 'item' c:\..\slist.cpp 57
Error 18 error C2761: 'void SortList:elete(void)' : member function redeclaration not allowed c:\..\slist.cpp 57
Error 19 error C2059: syntax error : ')' c:\..\slist.cpp 57
Error 20 error C2143: syntax error : missing ';' before '{' c:\..\slist.cpp 65
Error 21 error C2447: '{' : missing function header (old-style formal list?) c:\..\slist.cpp 65
Error 22 error C2146: syntax error : missing ')' before identifier 'item' c:\..\slist.cpp 79
Error 23 error C2761: 'bool SortList::isPresent(void) const' : member function redeclaration not allowed c:\..\slist.cpp 79
Error 24 error C2059: syntax error : ')' c:\..\slist.cpp 79
Error 25 error C2143: syntax error : missing ';' before '{' c:\..\slist.cpp 83
Error 26 error C2447: '{' : missing function header (old-style formal list?) c:\..\slist.cpp 83
Error 27 error C2065: 'data' : undeclared identifier c:\..\slist.cpp 95
Error 28 error C2146: syntax error : missing ')' before identifier 'item' c:\..\slist.cpp 98
Error 29 error C2761: 'void SortList::BinSearch(void) const' : member function redeclaration not allowed c:\..\slist.cpp 98
Error 30 error C2059: syntax error : ')' c:\..\slist.cpp 98
Error 31 error C2143: syntax error : missing ';' before '{' c:\..\slist.cpp 103
Error 32 error C2447: '{' : missing function header (old-style formal list?) c:\..\slist.cpp 103
</code></pre>
