2012-02-06 5 views
1

プロジェクトのC++コードをコンパイルしようとしています。私はFestivalをコンパイルすると、私は次のエラーを取得:'operator ='のあいまいなオーバーロード

Making in directory ./src ... 
Making in directory src/arch ... 
Making in directory src/arch/festival ... 
Making in directory src/modules ... 
Making in directory src/modules/rxp ... 
Making in directory src/modules/clunits ... 
Making in directory src/modules/clustergen ... 
Making in directory src/modules/MultiSyn ... 
Making in directory src/modules/MultiSyn/inst_tmpl ... 
Making in directory src/modules/hts_engine ... 
Making in directory src/modules/diphone ... 
gcc -c -g -I../include -I../../../src/include -I../../../../speech_tools/include di_io.cc 
di_io.cc: In function ‘void load_index(DIPHONE_DATABASE*)’: 
di_io.cc:111: error: ambiguous overload for ‘operator=’ in ‘line = EST_TokenStream::get_upto_eoln()()’ 
../../../../speech_tools/include/EST_String.h:477: note: candidates are: EST_String& EST_String::operator=(const char*) <near match> 
../../../../speech_tools/include/EST_String.h:479: note:     EST_String& EST_String::operator=(char) <near match> 
../../../../speech_tools/include/EST_String.h:481: note:     EST_String& EST_String::operator=(const EST_String&) <near match> 
make[3]: *** [di_io.o] Error 1 
make[2]: *** [diphone] Error 2 
make[1]: *** [modules] Error 2 
make: *** [src] Error 2 

エラーが発生した機能:

static void load_index(DIPHONE_DATABASE *database) 
{ 
    EST_TokenStream ts; 
    int i; 
    EST_String line; 

    if (ts.open(database->index_file) == -1) 
    { 
    cerr << "Diphone: Can't open file " << database->index_file << endl; 
    festival_error(); 
    } 

    for (i=0; (!ts.eof()) && (i<database->ndiphs);) 
    { 
    line = ts.get_upto_eoln(); //this is di_io.cc:111 
    if ((line.length() > 0) && (line[0] != ';')) 
    { 
     EST_TokenStream ls; 
     ls.open_string(line); 
     database->indx[i]->diph = wstrdup(ls.get().string()); 
     database->indx[i]->file = wstrdup(ls.get().string()); 
     database->indx[i]->beg = atof(ls.get().string()); 
     database->indx[i]->mid = atof(ls.get().string()); 
     database->indx[i]->end = atof(ls.get().string()); 
     ls.close(); 
     i++; 
    } 
    } 

    if (i == database->ndiphs) 
    { 
    cerr << "Diphone: too many diphones in DB" << endl; 
    festival_error(); 
    } 

    database->nindex = i; 
    database->ndiphs = i; 

    ts.close(); 
} 

をどのように私は上記のエラーを取り除くことができますか?

+0

ライン 'di_io.ccです:111'を? – sbi

+1

私は 'line = ts.get_upto_eoln();' – Chip

+0

を推測しています@Chip:私もそう思っていましたが、推測するのはばかげています。 – sbi

答えて

2

私はあなたが使用している非標準タイプからであると仮定しますspeech-toolsライブラリ、hereと書かれています。これは、クラス名をGoogleで検索したときに見つけたものです。それが間違っている場合は、質問がどこから来たのかを示すために更新してください。

私はまた、エラーライン(di_io.ccのライン111)が述べているものであると仮定します:

line = ts.get_upto_eoln(); 

をそれは私はそのエラー・メッセージを引き起こす可能性が見ることができる唯一の一つだからです。もう一度、それが違う場合は、質問を更新してください。

EST_TokenStream::get_upto_eolnは、EST_Tokenを返します。別のタイプ(EST_String)の変数に割り当てようとしていますが、暗黙の変換はありません。

あなたはそのstring機能使用EST_Stringに関数の結果を変換することができます:

line = ts.get_upto_eoln().string(); 
+0

私は質問で言及を見落としていたすべての事を謝罪します。私は鼻を地面に近づけすぎたと思う。この答えは問題解決の良い教訓でした。ありがとう! – Sriram

2

get_upto_eolnは何を返しますか?

operator=の正確なオーバーロードはEST_Stringクラスに指定できます。

それとも、あなたは明示的にそれのうち、文字列が好きなことができます:

line = std::string(ts.get_upto_eoln()); 

代わりの

line = ts.get_upto_eoln(); 
+0

です。返信ありがとうございます。 – Sriram

関連する問題