Mail Archives: djgpp/2004/03/30/08:46:25
X-Authentication-Warning: | delorie.com: mail set sender to djgpp-bounces using -f
|
From: | chris_tebbe AT yahoo DOT com (Chris)
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Recompiling old programs --> problems with fstream class
|
Date: | 30 Mar 2004 05:31:42 -0800
|
Organization: | http://groups.google.com
|
Lines: | 141
|
Message-ID: | <b687bbff.0403300531.2802145b@posting.google.com>
|
NNTP-Posting-Host: | 63.240.154.10
|
X-Trace: | posting.google.com 1080653503 27101 127.0.0.1 (30 Mar 2004 13:31:43 GMT)
|
X-Complaints-To: | groups-abuse AT google DOT com
|
NNTP-Posting-Date: | Tue, 30 Mar 2004 13:31:43 +0000 (UTC)
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
I cannot figure out why my old program no longer compiles under the
current release of DJGPP (it worked with a REALLY old version). As
you can see,
FSTREAM is include, but it says IFSTREAM is not declared in this
scope?! I
do not understand this error. Any help is greatly appreciated!
Code snippet from header file "matrix.h"
#include <fstream>
#include <string>
#include <iomanip>
#include <malloc.h>
#include <conio.h>
#include <time.h>
#include <stdlib.h>
#include "border.h"
#ifndef Width
#define Width 8
#endif
#ifndef Precision
#define Precision 4
#endif
#ifndef FieldFlags
#define FieldFlags ios::fixed, ios::floatfield
#endif
class Matrix {
private:
char name[20]; // matrix name
int rows; // matrix rows
int columns; // matrix columns
FLOAT_TYPE* elem; // pointer to matrix
data
public:
// Constructors
Matrix(); // default constructor
Matrix(float&); // conversion
constructor
Matrix(Matrix&); // copy constructor
Matrix(char*); // name-only
constructor
Matrix(int, int=0); // size-only
constructor
Matrix(char*, int, int=0); // name & size
constructor
// Destructor
~Matrix(); // destructor
// Member Functions
void SetName(char*); // set matrix name
void GetName(char*); // get matrix name
void SizeOf(void); // display size of
matrix
int NRows(void); // returns # of rows
int NCols(void); // returns # of
columns
void ReDim(int=0, int=0); // set matrix
dimensions
void ReDim(Matrix&); // set matrix
dimensions
void Randomize(int=1,int=0); // randomize a matrix
void Identity(int, int=0); // make Identity
Matrix
void Identity(Matrix&); // make Identity
Matrix
int Diag(Matrix&); // diagonalize a
matrix
void KeyLoad(void); // load Matrix from
Keyboard
int LoadAscii(ifstream&); // load Matrix from
Ascii File
int SaveAscii(ofstream&); // save Matrix to
Ascii File
int Load(ifstream&); // load Matrix from
Matlab File
int Save(ofstream&); // save Matrix to
Matlab File
void ErrorHandler(int); // matrix error
handler
FLOAT_TYPE Max(void); // get max element
FLOAT_TYPE Min(void); // get min element
// Overloaded Operators
FLOAT_TYPE& operator()(int, int); // overloaded ()
operator
Matrix& operator()(int,int,int,int); // get a submatrix
Matrix& operator+(Matrix&); // add matrices
Matrix& operator-(); // negate matrix
Matrix& operator-(Matrix&); // subtract matrices
Matrix& operator*(Matrix&); // multiply matrices
Matrix& operator=(Matrix&); // overloaded =
operator
Matrix& operator*=(Matrix&); // element by element
mult
Matrix& operator!(); // invert matrix
Matrix& operator~(); // transpose matrix
Matrix& operator||(Matrix&); // column augment 2
matrices
Matrix& operator&&(Matrix&); // row augment 2
matrices
int operator==(Matrix&); // compare 2 matrices
operator FLOAT_TYPE(); // Matrix ->
FLOAT_TYPE
Matrix& operator=(FLOAT_TYPE&); // FLOAT_TYPE ->
Matrix
friend Matrix& operator+(Matrix&, FLOAT_TYPE); // add matrix &
scalar
friend Matrix& operator+(FLOAT_TYPE, Matrix&); // add scalar &
matrix
friend Matrix& operator-(Matrix&, FLOAT_TYPE); // subtract scalar
from matrix
friend Matrix& operator-(FLOAT_TYPE, Matrix&); // subtract matrix
from scalar
friend Matrix& operator*(Matrix&, FLOAT_TYPE); // multiply matrix
& scalar
friend Matrix& operator*(FLOAT_TYPE, Matrix&); // multiply scalar
& matrix
friend ostream& operator<<(ostream&,Matrix&); // overloaded <<
operator
};
Error:
In file included from matrix.cc:7:
matrix.h:63: error: `ifstream' was not declared in this scope
matrix.h:63: error: parse error before `)' token
matrix.h:64: error: `ofstream' was not declared in this scope
matrix.h:64: error: parse error before `)' token
matrix.h:65: error: `ifstream' was not declared in this scope
matrix.h:65: error: parse error before `)' token
matrix.h:66: error: `ofstream' was not declared in this scope
matrix.h:66: error: parse error before `)' token
matrix.h:92: error: ISO C++ forbids declaration of `ostream' with no
type
matrix.h:92: error: `ostream' is neither function nor member function;
cannot
be declared friend
matrix.h:92: error: parse error before `&' token
- Raw text -