2012-02-06 3 views
1

C++ 코드를 Festival 프로젝트에서 컴파일하려고합니다.'operator ='에 대한 모호한 오버로드

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(); 
} 

어떻게 내가 위의 오류를 제거 할 수 있습니다 오류가 발생

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 

기능 : 나는 Festival를 컴파일 할 때, 나는 다음과 같은 오류를 얻을?

+0

라인'di_io.cc 어느 : 111'? – sbi

+1

나는 그것의'line = ts.get_upto_eoln();을 추측하고있다. – Chip

+0

@Chip : 나도 그렇게 생각했다. 그러나 추측해야하는 것은 어리 석다. – sbi

답변

2

의 내가 가정합니다을 사용하고있는 표준이 아닌 유형이에서 것을 speech-tools 라이브러리, here으로 문서화 되었기 때문에 클래스 이름을봤을 때 발견되었습니다. 그것이 틀린 경우, 출처가 어디인지를 나타 내기 위해 질문을 업데이트하십시오. 그게 내가 그 해당 오류 메시지가 발생할 수 있습니다 볼 수있는 유일한 사람은 이후

line = ts.get_upto_eoln(); 

;

또한 오류 라인 (라인 di_io.cc 111)는 말한다 일이라고 가정합니다 다시 말하지만, 다른 줄이면 질문을 업데이트하십시오.

EST_TokenStream::get_upto_eolnEST_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

관련 문제