when I do that I get several other errors .. here is my compile log now:
Compiler: Default compiler
Executing g++.exe...
g++.exe "D:\CS352\Week 4\week3-4Prog.cpp" -o "D:\CS352\Week 4\week3-4Prog.exe" -g3 -I"C:\Dev-Cpp\lib\gcc\mingw32\3.4.2\include" -I"C:\Dev-Cpp\include\c++\3.4.2\backward" -I"C:\Dev-Cpp\include\c++\3.4.2\mingw32" -I"C:\Dev-Cpp\include\c++\3.4.2" -I"C:\Dev-Cpp\include" -L"C:\Dev-Cpp\lib" -g3
In file included from C:/Dev-Cpp/include/c++/3.4.2/backward/strstream:51,
from D:\CS352\Week 4\/d_except.h:4,
from D:\CS352\Week 4\/d_vector.h:4,
from D:\CS352\Week 4\week3-4Prog.cpp:4:
C:/Dev-Cpp/include/c++/3.4.2/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <iostream> instead of the deprecated header <iostream.h>. To disable this warning use -Wno-deprecated.
Execution terminated
Compilation successful
This is what the header file looks like now:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
|
#ifndef EXCEPTION_CLASSES
#define EXCEPTION_CLASSES
#include <strstream>
#include <string>
using namespace std;
class baseException
{
public:
baseException(const string& str = ""):
msgString(str)
{
if (msgString == "")
msgString = "Unspecified exception";
}
string what() const
{
return msgString;
}
// protected allows a derived class to access msgString.
// chapter 13 discusses protected in detail
protected:
string msgString;
};
// failure to allocate memory (new() returns NULL)
class memoryAllocationError: public baseException
{
public:
memoryAllocationError(const string& msg = ""):
baseException(msg)
{}
};
// function argument out of proper range
class rangeError: public baseException
{
public:
rangeError(const string& msg = ""):
baseException(msg)
{}
};
// index out of range
class indexRangeError: public baseException
{
public:
indexRangeError(const string& msg, int i, int size):
baseException()
{
char indexString[80];
ostrstream indexErr(indexString, 80);
indexErr << msg << " index " << i << " size = " << size << ends;
// indexRangeError can modify msgString, since it is in
// the protected section of baseException
msgString = indexString;
}
};
// attempt to erase from an empty container
class underflowError: public baseException
{
public:
underflowError(const string& msg = ""):
baseException(msg)
{}
};
// attempt to insert into a full container
class overflowError: public baseException
{
public:
overflowError(const string& msg = ""):
baseException(msg)
{}
};
// error in expression evaluation
class expressionError: public baseException
{
public:
expressionError(const string& msg = ""):
baseException(msg)
{}
};
// bad object reference
class referenceError: public baseException
{
public:
referenceError(const string& msg = ""):
baseException(msg)
{}
};
// feature not implemented
class notImplementedError: public baseException
{
public:
notImplementedError(const string& msg = ""):
baseException(msg)
{}
};
// date errors
class dateError: public baseException
{
public:
dateError(const string& first, int v, const string& last):
baseException()
{
char dateStr[80];
ostrstream dateErr(dateStr, 80);
dateErr << first << ' ' << v << ' ' << last << ends;
// dateError can modify msgString, since it is in
// the protected section of baseException
msgString = dateStr;
}
};
// error in graph class
class graphError: public baseException
{
public:
graphError(const string& msg = ""):
baseException(msg)
{}
};
// file open error
class fileOpenError: public baseException
{
public:
fileOpenError(const string& fname):
baseException()
{
char errorStr[80];
ostrstream fileErr(errorStr, 80);
fileErr << "Cannot open \"" << fname << "\"" << ends;
// fileOpenError can modify msgString, since it is in
// the protected section of baseException
msgString = errorStr;
}
};
// error in graph class
class fileError: public baseException
{
public:
fileError(const string& msg = ""):
baseException(msg)
{}
};
#endif // EXCEPTION_CLASSES
|
I don't see where I would get docked any points since this file was provided for the program.