2014-02-21 26 views
0

我不确定问题到底是什么,但与infile有关的事情似乎是造成这种情况的原因?任何解决方法?我是否必须下载最新版本的mingw或什么?与infile有关的编译错误

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&);

+1

您正在尝试复制文件流。流不能被复制。 – 0x499602D2

+0

嗯,我正在运行一个文件,有人给我,显然它应该工作。很好,infile作为函数的第二行被调用的参考。 – OnTheFly

+0

也错误不指向该行代码。 – OnTheFly

回答

1

文件流不允许复制。我猜你的意思是使用一个参考:

std::ifstream& currentDocument = infile; 

虽然这是有问题的,为什么你需要首先该行。

+0

不起作用。哦,我的上帝 – OnTheFly

+0

@OnTheFly什么不行?请详细说明。 – 0x499602D2

0

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