Stand-Alone C ++プログラムでC ++で書かれたフェスティバルコードの一部をコンパイルする

StackOverflow https://stackoverflow.com/questions/8925118

  •  30-10-2019
  •  | 
  •  

質問

私はの選択部分を使用しようとしています Festival コード(C ++で書かれています)と私自身でそれらを使用しようとしています C++ プログラム。この質問は、フェスティバルAPIを使用することではなく、内の関数についてであることに注意してください Festival それは直接使用できます。

私が書いたプログラムには、 C++ スタイル string タイプのオブジェクトを初期化しようとします EST_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;
}  

私は(コマンドラインから直接(現在はメイクファイルなし))のようにコンパイルしようとしています。

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  

コードを適切にコンパイルするにはどうすればよいですか?どこが間違っていますか?

正しい解決策はありません

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top