C++のios_baseが公開されていないといわれる
コンソールAPPを途中まで作り、ビルドできるかためしたところ、下記のようなエラーが残ったのですが、意味がよくわかりません。
In file included from /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/include/c++/ios:42:0, from /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/include/c++/istream:38, from /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/include/c++/sstream:38, from stdafx.h:11, from OperationService.cpp:1: /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/include/c++/bits/ios_base.h: コピーコンストラクタ ‘std::basic_ios::basic_ios(const std::basic_ios&)’ 内: /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/include/c++/bits/ios_base.h:786:5: エラー: ‘std::ios_base::ios_base(const std::ios_base&)’ は非公開です ios_base(const ios_base&); ^ In file included from /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/include/c++/ios:44:0, from /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/include/c++/istream:38, from /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/include/c++/sstream:38, from stdafx.h:11, from OperationService.cpp:1: /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/include/c++/bits/basic_ios.h:66:11: エラー: within this context class basic_ios : public ios_base ^ In file included from stdafx.h:11:0, from OperationService.cpp:1: /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/include/c++/sstream: コピーコンストラクタ ‘std::basic_stringstream::basic_stringstream(const std::basic_stringstream&)’ 内: /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/include/c++/sstream:502:11: 備考: synthesized method ‘std::basic_ios::basic_ios(const std::basic_ios&)’ first required here class basic_stringstream : public basic_iostream ^ In file included from /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/include/c++/ios:43:0, from /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/include/c++/istream:38, from /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/include/c++/sstream:38, from stdafx.h:11, from OperationService.cpp:1: /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/include/c++/streambuf: コピーコンストラクタ ‘std::basic_stringbuf::basic_stringbuf(const std::basic_stringbuf&)’ 内: /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/include/c++/streambuf:802:7: エラー: ‘std::basic_streambuf::basic_streambuf(const std::basic_streambuf&) [with _CharT = char; _Traits = std::char_traits]’ は非公開です basic_streambuf(const basic_streambuf& __sb) ^ In file included from stdafx.h:11:0, from OperationService.cpp:1: /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/include/c++/sstream:64:11: エラー: within this context class basic_stringbuf : public basic_streambuf ^ /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/include/c++/sstream: コピーコンストラクタ ‘std::basic_stringstream::basic_stringstream(const std::basic_stringstream&)’ 内: /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/include/c++/sstream:502:11: 備考: synthesized method ‘std::basic_stringbuf::basic_stringbuf(const std::basic_stringbuf&)’ first required here class basic_stringstream : public basic_iostream ^ OperationService.cpp: メンバ関数 ‘std::stringstream OperationService::createJA()’ 内: OperationService.cpp:39:9: 備考: synthesized method ‘std::basic_stringstream::basic_stringstream(const std::basic_stringstream&)’ first required here return ss; ^
C++開発は2度目(以前もコンソールアプリケーションを作成しました。)
ほとんど実装は以前のものの流用ですが、以前はビルドできました。
ios_baseが公開されていないとのことなので、fstreamの部分が悪いのかと思い、いろいろいじってみましたがうまくいきません。
以下、おそらくエラーの該当クラスです。
#include "stdafx.h"
#include "OperationService.h"
#include "DomParser.h"
using namespace std;
#define ASSERT_JA "~/.base_ja"
#define ASSERT_EN "~/.base_en"
#define MIGR_JA "~/.mig_ja"
#define MIGR_EN "~/.mig_en"
/**
* Migrationの英語版
**/
stringstream OperationService::createEN() {
stringstream ss;
ss << 略
ss << "Before January 8th, 2014" << endl;
return ss;
}
/**
* Migrationの日本語版
**/
stringstream OperationService::createJA() {
stringstream ss;
ss << 略
ss << "1.0が破棄されると、XMPPサービスおよびAPIは利用できなくなります。" << endl;
return ss;
}
/**
* diff
**/
void OperationService::diff() {
cout << "====================== diffedence check start =========================" << endl;
fstream ifs;
DomParser domParser;
// 日本語正規ドキュメント作成
ifs.open(ASSERT_JA, ios::in);
if (!ifs) {
ifs.close();
ifs.open(ASSERT_JA, ios::out);
ifs << createJA().str() << endl;
ifs.close();
}
// 英語正規ドキュメント作成
ifs.open(ASSERT_EN, ios::in);
if (!ifs) {
ifs.close();
ifs.open(ASSERT_EN, ios::out);
ifs << createEN().str() << endl;
ifs.close();
}
stringstream ss;
// 英語HTML取得
ss << "wget https://dummy/migrations -O " << MIGR_EN << endl;
system(ss.str().c_str());
ss.clear();
// 日本語HTML取得
ss << "wget https://dummy/migrations?locale=ja_JP -O " << MIGR_JA << endl;
system(ss.str().c_str());
ss.clear();
// 日本語MigrationTEXT抽出
{
xmlDocPtr doc = domParser.parse(MIGR_JA);
xmlNodeSetPtr nodeSet = domParser.executeXpath(doc, (xmlChar *)"//./text()");
string content = (char*)xmlXPathNodeSetItem(nodeSet, 0)->content;
ifs.open(MIGR_JA, ios::out | ios::trunc);
ifs << content << endl;
ifs.close();
}
// 英語MigrationTEXT抽出
{
xmlDocPtr doc = domParser.parse(MIGR_EN);
xmlNodeSetPtr nodeSet = domParser.executeXpath(doc, (xmlChar *)"//./text()");
string content = (char*)xmlXPathNodeSetItem(nodeSet, 0)->content;
ifs.open(MIGR_EN, ios::out | ios::trunc);
ifs << content << endl;
ifs.close();
}
// 比較実行 日本語
cout << "--------- Japanese ----------" << endl << endl << endl;
ss << "diff -Bt " << ASSERT_JA << " " << MIGR_JA;
system(ss.str().c_str());
ss.clear();
// 比較実行 英語
cout << "--------- English ----------" << endl << endl << endl;
ss << "diff -Bt " << ASSERT_EN << " " << MIGR_EN;
system(ss.str().c_str());
ss.clear();
}