私はこのコンパイラエラーに困惑しており、何が起こっているのか一生わかりません。エラー全体は私にはあまり意味がありません。また、このコードのほとんどが正常に機能していた以前のプロジェクトからコピーされたものであることが不思議です。
エラーとコードは次のとおりです。
1>ClCompile:
1> main.cpp
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\fstream(1347): error C2248: 'std::basic_ios<_Elem,_Traits>::basic_ios' : cannot access private member declared in class 'std::basic_ios<_Elem,_Traits>'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\ios(176) : see declaration of 'std::basic_ios<_Elem,_Traits>::basic_ios'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1> This diagnostic occurred in the compiler generated function 'std::basic_fstream<_Elem,_Traits>::basic_fstream(const std::basic_fstream<_Elem,_Traits> &)'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>
1> ]
1>
1>Build FAILED.
そして、これがmain.cppの非常にマイナーなコードです*:
#include <Mage/File/PlainText.h>
#include <cstdio>
int main(int argc, char** argv) {
Mage::FilePlainText file = Mage::FilePlainText("shadow_pcf_gaussian_fragment.glsl");
printf("%s\n", file.content().c_str());
while (true) { }
return 0;
}
そしてコードfile.content():
Mage::String FilePlainText::content() {
Mage::String src;
try {
open();
// We allocate enough memory to copy the entire content to memory.
mHandle.seekg(0, std::ios::end);
src.reserve(mHandle.tellg());
// Set pointer to 0 and copy to memory.
mHandle.seekg(0, std::ios::beg);
src.assign((std::istreambuf_iterator<char>(mHandle)),
std::istreambuf_iterator<char>());
close();
} catch (Mage::Exception& e) {
throw e;
}
return src;
}
私の推測では、これと関係があると思います。