There are a couple of problems.
1. You didn't provide common.h.
This is probably where all the "abort" things come from in the reduced error messages.
2. In header files, you need to use the fully qualified namespace.
3. ios::noreplace is a C++23 feature only.
cppreference.com is an excellent resource for tracking when things got added (or removed) from the ever shifting sands of the C++ language spec.
My diffs and reduced list of error messages.
Code:
diff --git a/BUFFER.CPP b/BUFFER.CPP
index c51488a..603cc03 100644
--- a/BUFFER.CPP
+++ b/BUFFER.CPP
@@ -23,7 +23,7 @@
#include <iostream>
#include <fstream>
#include <ctime>
-#include "common.h"
+//#include "common.h"
#include "buffer.h"
using namespace std;
@@ -54,7 +54,9 @@ TTextInBuffer::TTextInBuffer(const char *pInputFileName, TAbortCode ac)
strcpy(pFileName, pInputFileName);
//--Open the input file. Abort if failed.
- file.open(pFileName, ios::in ! ios::noreplace); // +=+
+ file.open(pFileName, ios::in /*!! | ios::noreplace */ ); // +=+ use bitwise-or
+ //!! ios::noreplace is C++23 and later
+ //!! https://en.cppreference.com/w/cpp/io/ios_base
if (!file.good()) AbortTranslation(ac); // +=+
}
diff --git a/BUFFER.H b/BUFFER.H
index 9e7951a..0d4eaa6 100644
--- a/BUFFER.H
+++ b/BUFFER.H
@@ -43,7 +43,11 @@ const int maxInputBufferSize = 256;
class TTextInBuffer {
protected:
- fstream file; // input text file +=+ 'fstream' does not name a type
+ //!! Need to use std:: (or whatever the appropriate namespace is when
+ //!! referring to symbols in header files.
+ //!! DO NOT have using namespace std; in header files as a quick
+ //!! get out of jail crutch. It will hurt you bad later on.
+ std::fstream file; // input text file +=+ 'fstream' does not name a type
char *const pFileName; // ptr to the file name
char text[maxInputBufferSize]; // input text buffer
char *pChar; // ptr to the current char
In file included from BUFFER.CPP:27:
buffer.h:59:47: error: 'TAbortCode' has not been declared
TTextInBuffer(const char *pInputFileName, TAbortCode ac);
^~~~~~~~~~
BUFFER.CPP:50:58: error: 'TAbortCode' has not been declared
TTextInBuffer::TTextInBuffer(const char *pInputFileName, TAbortCode ac)
^~~~~~~~~~
BUFFER.CPP: In constructor 'TTextInBuffer::TTextInBuffer(const char*, int)':
BUFFER.CPP:60:23: error: 'AbortTranslation' was not declared in this scope
if (!file.good()) AbortTranslation(ac); // +=+
^~~~~~~~~~~~~~~~
BUFFER.CPP: In constructor 'TSourceBuffer::TSourceBuffer(const char*)':
BUFFER.CPP:125:38: error: 'abortSourceFileOpenFailed' was not declared in this scope
: TTextInBuffer(pSourceFileName, abortSourceFileOpenFailed)
^~~~~~~~~~~~~~~~~~~~~~~~~
BUFFER.CPP: In member function 'virtual char TSourceBuffer::GetLine()':
BUFFER.CPP:153:37: error: 'currentLineNumber' was not declared in this scope
if (listFlag) list.PutLine(text, ++currentLineNumber,
^~~~~~~~~~~~~~~~~
BUFFER.CPP:154:8: error: 'currentNestingLevel' was not declared in this scope
currentNestingLevel);
^~~~~~~~~~~~~~~~~~~
Oh, and do yourself a favour by replacing all those char* pointers (and bad attempts at memory management) with std::string instances.