want to declare an ifstream as part of my class

hello

whne I declare a member of type ifstream in my class, I get errors such as:

error: within this context
/usr/lib/gcc/i386-redhat-linux/3.4.2/../../../../include/c++/3.4.2/streambuf: In member function `std::basic_filebuf<char, std::char_traits<char> >& std::basic_filebuf<char, std::char_traits<char> >::operator=(const std::basic_filebuf<char, std::char_traits<char> >&)':
/usr/lib/gcc/i386-redhat-linux/3.4.2/../../../../include/c++/3.4.2/streambuf:776: error: `std::basic_streambuf<_CharT, _Traits>& std::basic_streambuf<_CharT, _Traits>::operator=(const std::basic_streambuf<_CharT, _Traits>&) [with _CharT = char, _Traits = std::char_traits<char>]' is private

and this happens if I just declare something of type ifstream as one of my public member variables , like so:

#include <iostream>
#include <fstream>
using namespace std;

class SOMECLASS
{
    void blabla()
    ifstream infile;
};

I'm on a linux, why doesnt it like this?????
Thank you in advance!!
LD
lost_bits1110Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

lost_bits1110Author Commented:
ok i realize now i dont need to declare it in my file but now i get

*** glibc detected *** double free or corruption:

manchCommented:
You haven't writteh .h in the Header Files Probably

you must write

# include <iostream.h>
# include <fstream.h>

and then check the lib path of the c++ header files

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
arun_vipCommented:
Can you echo the lib path
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C++

From novice to tech pro — start learning today.