0
votes

I am not sure what the problem is exactly, but something that has to do with infile seems to be causing this? Any workaround for this? Do I have to download the latest version of mingw or something?

ifstream inFile("testdoc.txt");

std::ifstream currentDocument = infile;

c:\qt\qt5.2.1\tools\mingw48_32\lib\gcc\i686-w64-mingw32\4.8.0\include\c++\bits\ios_base.h:786: error: 'std::ios_base::ios_base(const std::ios_base&)' is private ios_base(const ios_base&);

2
You're trying to copy the file stream. Streams cannot be copied. - 0x499602D2
umm, i am running a file that someone gave me and apparently it's supposed to work. great, infile was passed as a reference in the function the second line is called. - OnTheFly
also the errors doesn't point to that line of code. - OnTheFly
infile may have been passed as a reference, but ifstream f = infile still attempts to copy-construct it. Also, the error doesn't point to that line because it's pointing to the private copy-constructors of ios_base and the stream buffer, the things which don't actually allow a copy. - 0x499602D2

2 Answers

1
votes

File streams don't allow copying. I guess you meant to use a reference:

std::ifstream& currentDocument = infile;

Though it's questionable why you need that line in the first place.

0
votes

NOTE -- Stream objects must never be copied or assigned to each other. There is the reason, please read it!