以下:
#include <fstream>
using namespace std;
ifstream cin = ifstream("mooomoo.in");
ofstream cout = ofstream("mooomoo.out");
clang++(xcode自带)和cl.exe(msvc 2013)都可以编译过,g++会出现编译错误:
In file included from c:\mingw\bin\../lib/gcc/mingw32/4.7.2/include/c++/ios:43:0,
from c:\mingw\bin\../lib/gcc/mingw32/4.7.2/include/c++/istream:40,
from c:\mingw\bin\../lib/gcc/mingw32/4.7.2/include/c++/fstream:40,
from 107265.cpp:1:
c:\mingw\bin\../lib/gcc/mingw32/4.7.2/include/c++/bits/ios_base.h: 在复制构造函数‘std::basic_ios<char>::basic_ios(const std::basic_ios<char>&)’:
c:\mingw\bin\../lib/gcc/mingw32/4.7.2/include/c++/bits/ios_base.h:788:5: 错误:‘std::ios_base::ios_base(const std::ios_base&)’是私有的
In file included from c:\mingw\bin\../lib/gcc/mingw32/4.7.2/include/c++/ios:45:0,
from c:\mingw\bin\../lib/gcc/mingw32/4.7.2/include/c++/istream:40,
from c:\mingw\bin\../lib/gcc/mingw32/4.7.2/include/c++/fstream:40,
from 107265.cpp:1:
c:\mingw\bin\../lib/gcc/mingw32/4.7.2/include/c++/bits/basic_ios.h:64:11: 错误:在此上下文中
In file included from 107265.cpp:1:0:
c:\mingw\bin\../lib/gcc/mingw32/4.7.2/include/c++/fstream: 在复制构造函数‘std::basic_ifstream<char>::basic_ifstream(const std::basic_ifstream<char>&)’:
c:\mingw\bin\../lib/gcc/mingw32/4.7.2/include/c++/fstream:420:11: 附注:在这里第一次需要生成的方法‘std::basic_ios<char>::basic_ios(const std::basic_ios<char>&)’
In file included from c:\mingw\bin\../lib/gcc/mingw32/4.7.2/include/c++/ios:44:0,
from c:\mingw\bin\../lib/gcc/mingw32/4.7.2/include/c++/istream:40,
from c:\mingw\bin\../lib/gcc/mingw32/4.7.2/include/c++/fstream:40,
from 107265.cpp:1:
c:\mingw\bin\../lib/gcc/mingw32/4.7.2/include/c++/streambuf: 在复制构造函数‘std::basic_filebuf<char>::basic_filebuf(const std::basic_filebuf<char>&)’:
c:\mingw\bin\../lib/gcc/mingw32/4.7.2/include/c++/streambuf:800:7: 错误:‘std::basic_streambuf<_CharT, _Traits>::basic_streambuf(const __streambuf_type&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_streambuf<_CharT, _Traits>::__streambuf_type = std::basic_streambuf<char>]’是私有的
In file included from 107265.cpp:1:0:
c:\mingw\bin\../lib/gcc/mingw32/4.7.2/include/c++/fstream:69:11: 错误:在此上下文中
c:\mingw\bin\../lib/gcc/mingw32/4.7.2/include/c++/fstream: 在复制构造函数‘std::basic_ifstream<char>::basic_ifstream(const std::basic_ifstream<char>&)’:
c:\mingw\bin\../lib/gcc/mingw32/4.7.2/include/c++/fstream:420:11: 附注:在这里第一次需要生成的方法‘std::basic_filebuf<char>::basic_filebuf(const std::basic_filebuf<char>&)’
107265.cpp: 在全局域:
107265.cpp:3:37: 附注:在这里第一次需要生成的方法‘std::basic_ifstream<char>::basic_ifstream(const std::basic_ifstream<char>&)’
不知原因,求解。。
#include <fstream>
using namespace std;
ifstream cin = ifstream("mooomoo.in");
ofstream cout = ofstream("mooomoo.out");
clang++(xcode自带)和cl.exe(msvc 2013)都可以编译过,g++会出现编译错误:
In file included from c:\mingw\bin\../lib/gcc/mingw32/4.7.2/include/c++/ios:43:0,
from c:\mingw\bin\../lib/gcc/mingw32/4.7.2/include/c++/istream:40,
from c:\mingw\bin\../lib/gcc/mingw32/4.7.2/include/c++/fstream:40,
from 107265.cpp:1:
c:\mingw\bin\../lib/gcc/mingw32/4.7.2/include/c++/bits/ios_base.h: 在复制构造函数‘std::basic_ios<char>::basic_ios(const std::basic_ios<char>&)’:
c:\mingw\bin\../lib/gcc/mingw32/4.7.2/include/c++/bits/ios_base.h:788:5: 错误:‘std::ios_base::ios_base(const std::ios_base&)’是私有的
In file included from c:\mingw\bin\../lib/gcc/mingw32/4.7.2/include/c++/ios:45:0,
from c:\mingw\bin\../lib/gcc/mingw32/4.7.2/include/c++/istream:40,
from c:\mingw\bin\../lib/gcc/mingw32/4.7.2/include/c++/fstream:40,
from 107265.cpp:1:
c:\mingw\bin\../lib/gcc/mingw32/4.7.2/include/c++/bits/basic_ios.h:64:11: 错误:在此上下文中
In file included from 107265.cpp:1:0:
c:\mingw\bin\../lib/gcc/mingw32/4.7.2/include/c++/fstream: 在复制构造函数‘std::basic_ifstream<char>::basic_ifstream(const std::basic_ifstream<char>&)’:
c:\mingw\bin\../lib/gcc/mingw32/4.7.2/include/c++/fstream:420:11: 附注:在这里第一次需要生成的方法‘std::basic_ios<char>::basic_ios(const std::basic_ios<char>&)’
In file included from c:\mingw\bin\../lib/gcc/mingw32/4.7.2/include/c++/ios:44:0,
from c:\mingw\bin\../lib/gcc/mingw32/4.7.2/include/c++/istream:40,
from c:\mingw\bin\../lib/gcc/mingw32/4.7.2/include/c++/fstream:40,
from 107265.cpp:1:
c:\mingw\bin\../lib/gcc/mingw32/4.7.2/include/c++/streambuf: 在复制构造函数‘std::basic_filebuf<char>::basic_filebuf(const std::basic_filebuf<char>&)’:
c:\mingw\bin\../lib/gcc/mingw32/4.7.2/include/c++/streambuf:800:7: 错误:‘std::basic_streambuf<_CharT, _Traits>::basic_streambuf(const __streambuf_type&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_streambuf<_CharT, _Traits>::__streambuf_type = std::basic_streambuf<char>]’是私有的
In file included from 107265.cpp:1:0:
c:\mingw\bin\../lib/gcc/mingw32/4.7.2/include/c++/fstream:69:11: 错误:在此上下文中
c:\mingw\bin\../lib/gcc/mingw32/4.7.2/include/c++/fstream: 在复制构造函数‘std::basic_ifstream<char>::basic_ifstream(const std::basic_ifstream<char>&)’:
c:\mingw\bin\../lib/gcc/mingw32/4.7.2/include/c++/fstream:420:11: 附注:在这里第一次需要生成的方法‘std::basic_filebuf<char>::basic_filebuf(const std::basic_filebuf<char>&)’
107265.cpp: 在全局域:
107265.cpp:3:37: 附注:在这里第一次需要生成的方法‘std::basic_ifstream<char>::basic_ifstream(const std::basic_ifstream<char>&)’
不知原因,求解。。