Thread: Re: [Dev-C++] no match for istream & >> {unknown type}
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: <Dou...@ao...> - 2001-02-19 15:23:44
|
The include file needed for the istream class is fstream. The include file entry would therefore be #include <fstream> |
|
From: Robert D B. <lon...@ju...> - 2001-02-19 21:00:33
|
I am not a real expert on c++, however you migh try this and let me know.
class Student_info {
public:
Student_info();
Student_info(std::istream&);
std::string name() const {return n;}
bool valid() const {return !homework.empty();}
std::istream& read(std::istream&);
double grade() const;
private:
std::string n;
double midterm, final;
std::vector<double> homework;
std::istream& is; ADD
};
lonestar36
On Mon, 19 Feb 2001 19:55:26 -0000 "softnasolutions-ltd.fsbusiness.co.uk"
<so...@so...> writes:
> I have tried it but i still have the error. I have attached all my
> file and
> i will be most grateful if you can have a look and tell me what is
> wrong.
>
> ----- Original Message -----
> From: <Dou...@ao...>
> To: <dev...@li...>
> Sent: Monday, February 19, 2001 3:24 PM
> Subject: Re: [Dev-C++] no match for istream & >> {unknown type}
>
>
> > The include file needed for the istream class is fstream. The
> include
> file entry would therefore be
> > #include <fstream>
> >
> > _______________________________________________
> > Dev-cpp-users mailing list
> > Dev...@li...
> > http://lists.sourceforge.net/lists/listinfo/dev-cpp-users
> >
>
|
|
From: softnasolutions-ltd.fsbusiness.co.uk <so...@so...> - 2001-02-19 21:36:01
|
I have tried it but the errors increased.
----- Original Message -----
From: "Robert D BAugh" <lon...@ju...>
To: <dev...@li...>
Sent: Monday, February 19, 2001 8:57 PM
Subject: Re: [Dev-C++] no match for istream & >> {unknown type}
> I am not a real expert on c++, however you migh try this and let me know.
>
> class Student_info {
> public:
> Student_info();
> Student_info(std::istream&);
> std::string name() const {return n;}
> bool valid() const {return !homework.empty();}
> std::istream& read(std::istream&);
> double grade() const;
> private:
> std::string n;
> double midterm, final;
> std::vector<double> homework;
> std::istream& is; ADD
> };
> lonestar36
> On Mon, 19 Feb 2001 19:55:26 -0000 "softnasolutions-ltd.fsbusiness.co.uk"
> <so...@so...> writes:
> > I have tried it but i still have the error. I have attached all my
> > file and
> > i will be most grateful if you can have a look and tell me what is
> > wrong.
> >
> > ----- Original Message -----
> > From: <Dou...@ao...>
> > To: <dev...@li...>
> > Sent: Monday, February 19, 2001 3:24 PM
> > Subject: Re: [Dev-C++] no match for istream & >> {unknown type}
> >
> >
> > > The include file needed for the istream class is fstream. The
> > include
> > file entry would therefore be
> > > #include <fstream>
> > >
> > > _______________________________________________
> > > Dev-cpp-users mailing list
> > > Dev...@li...
> > > http://lists.sourceforge.net/lists/listinfo/dev-cpp-users
> > >
> >
>
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> http://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|
|
From: Robert D B. <lon...@ju...> - 2001-02-20 13:36:59
|
Hay thanks. It is now obvious. However, now when I compile I am getting
link errors.
They referance heap errors. How do you initialize the heap??
thanks lonestar
On Tue, 20 Feb 2001 12:27:03 +0100 Bolek Vrany
<vr...@pa...> writes:
> Hi,
>
> the real problem is that name is a method of the Student_info class,
> not
> a data field (see declaration). You have to change your code to
>
> istream& Student_info::read(istream& is)
> {
> //read and store the student's name and midterm and final
> exams
> grades
> is >> n >> midterm >> final;
>
> read_hw(is, homework); //read and store all the stud
> homework grades
> return is;
> }
>
> I think this is what you have wanted. BTW, istream& read_hw(istream&
> in,
> vector<double>& hw) should return a value. Dev-CPP didn't warn me
> about
> it, but C++ Builder did.
>
>
> --
> ============================================================
> Ing. Boleslav Vrany
> Stanice techniku DDM hl. m. Prahy
> Pod Juliskou 2a
> Praha 6 - Dejvice
> 16000
> Czech Republic
>
> tel. (420 2) 243 10 240
>
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> http://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|
|
From: Bolek V. <vr...@pa...> - 2001-02-20 14:29:37
|
Hi,
it compiles OK under both Dev-CPP 4.0 and C++ Builder 5.0. It seems to
run and work fine. If you are getting linker errors, have you library
directories set up correctly? And what excatly do you mean by linker
referencing heap errors? I always thought heap errors are runtime
errors, so they cannot occur at link time. I didn't take care of the
heap at all. Under both compilers I just created a new console project
with default settings - for Dev-CPP see appended files. Could you send
me yours?
Thanks
--
============================================================
Ing. Boleslav Vrany
Stanice techniku DDM hl. m. Prahy
Pod Juliskou 2a
Praha 6 - Dejvice
16000
Czech Republic
tel. (420 2) 243 10 240 |
|
From: softnasolutions-ltd.fsbusiness.co.uk <so...@so...> - 2001-02-19 19:54:44
|
I have tried it but i still have the error. I have attached all my file and
i will be most grateful if you can have a look and tell me what is wrong.
----- Original Message -----
From: <Dou...@ao...>
To: <dev...@li...>
Sent: Monday, February 19, 2001 3:24 PM
Subject: Re: [Dev-C++] no match for istream & >> {unknown type}
> The include file needed for the istream class is fstream. The include
file entry would therefore be
> #include <fstream>
>
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> http://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|
|
From: Bolek V. <vr...@pa...> - 2001-02-20 11:24:18
|
Hi,
the real problem is that name is a method of the Student_info class, not
a data field (see declaration). You have to change your code to
istream& Student_info::read(istream& is)
{
//read and store the student's name and midterm and final exams
grades
is >> n >> midterm >> final;
read_hw(is, homework); //read and store all the stud
homework grades
return is;
}
I think this is what you have wanted. BTW, istream& read_hw(istream& in,
vector<double>& hw) should return a value. Dev-CPP didn't warn me about
it, but C++ Builder did.
--
============================================================
Ing. Boleslav Vrany
Stanice techniku DDM hl. m. Prahy
Pod Juliskou 2a
Praha 6 - Dejvice
16000
Czech Republic
tel. (420 2) 243 10 240
|
|
From: softnasolutions-ltd.fsbusiness.co.uk <so...@so...> - 2001-02-20 20:30:47
|
Thanks very much everybody who helped. My problem is soted now. By the way
what is "heap error"
----- Original Message -----
From: "Bolek Vrany" <vr...@pa...>
To: <dev...@li...>
Sent: Tuesday, February 20, 2001 11:27 AM
Subject: Re: [Dev-C++] no match for istream & >> {unknown type}
> Hi,
>
> the real problem is that name is a method of the Student_info class, not
> a data field (see declaration). You have to change your code to
>
> istream& Student_info::read(istream& is)
> {
> //read and store the student's name and midterm and final exams
> grades
> is >> n >> midterm >> final;
>
> read_hw(is, homework); //read and store all the stud
> homework grades
> return is;
> }
>
> I think this is what you have wanted. BTW, istream& read_hw(istream& in,
> vector<double>& hw) should return a value. Dev-CPP didn't warn me about
> it, but C++ Builder did.
>
>
> --
> ============================================================
> Ing. Boleslav Vrany
> Stanice techniku DDM hl. m. Prahy
> Pod Juliskou 2a
> Praha 6 - Dejvice
> 16000
> Czech Republic
>
> tel. (420 2) 243 10 240
>
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> http://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|
|
From: Bolek <vr...@pa...> - 2001-02-21 12:40:55
|
Heap is the memory used for dynamic allocation. So heap error is an
error using this. I would thought about it as not an ordinary allocation
error, but something that is about "confusing" the heap.
> Thanks very much everybody who helped. My problem is soted now. By the way
> what is "heap error"
--
============================================================
Ing. Boleslav Vrany
Stanice techniku DDM hl. m. Prahy
Pod Juliskou 2a
Praha 6 - Dejvice
16000
Czech Republic
tel. (420 2) 243 10 240
|