Festival
코드의 선택적 부분 (C++로 작성)을 사용하고 자신의 C++
프로그램에서이 코드를 사용하려고합니다. 이 질문은 Festival API를 사용하는 것이 아니라 직접 사용할 수있는 Festival
의 기능에 관한 것입니다.독립 실행 형 C++ 프로그램에서 C++로 작성된 축제 코드의 부분 컴파일
내가 쓴 프로그램은 C++
스타일 string
에 소요 유형 EST_String
의 객체 (축제 String 클래스의 내부 구현)을 초기화하려고합니다. 그런 다음 객체를 인쇄하려고합니다.
는 코드 내가 가진 :
/*EST_String is a string implementation for the festival project.
* This program simply takes in a C++-style string and returns an EST_String.
* This program is being used to test for makefiles etc.
*/
#include <iostream>
#include <EST_String.h>
#include <string>
#include <cstdlib>
using namespace std;
int main(int argc, char *argv[]) {
if(argc != 2) {
cout << "Correct usage: <binary> <string>" << endl;
exit(5);
}
string word(argv[1]);
EST_String e(word.c_str()); //init EST_String.
cout << "C++ String = " << word << endl;
cout << "EST_String = ";
cout << e;
return 0;
}
내가 컴파일과 같이 (직접 명령 줄 현재 (NO 메이크)에서) 노력하고 있어요 : 내가 오류가
g++ -I../../speech_tools/include -I../../speech_tools/base_class/string -L../../speech_tools/lib/ -lestbase -lncurses -lasound -leststring -lestools usingESTString.C -o usingESTString
:
/tmp/cczyGTfm.o: In function `main':
usingESTString.C:(.text+0x91): undefined reference to `EST_String::EST_String(char const*)'
/tmp/cczyGTfm.o: In function `EST_Chunk::operator--()':
usingESTString.C:(.text._ZN9EST_ChunkmmEv[EST_Chunk::operator--()]+0x3e): undefined reference to `EST_Chunk::~EST_Chunk()'
usingESTString.C:(.text._ZN9EST_ChunkmmEv[EST_Chunk::operator--()]+0x49): undefined reference to `EST_Chunk::operator delete(void*)'
collect2: ld returned 1 exit status
코드를 올바르게 컴파일하려면 어떻게해야합니까? 내가 어디로 잘못 가고 있니?
특히 원본 파일 다음에 명령 줄에 링크 된 라이브러리를 놓습니다. –
@ 조아킴 : 네. 그것이 문제였습니다. 왜 당신이 대답에 당신의 코멘트를하지 않으며 나는 그것을 옳은 것으로 받아 들일 것입니다. 작은 설명도 훌륭합니다. 감사! – Sriram