1

我正在尝试gcc在 Ubuntu 10.04中编译以下代码

#include <fst/fstlib.h>

namespace fst {
  // Reads in an input FST. 
  StdVectorFst *input = StdVectorFst::Read("input.fst");

  // Reads in the transduction model. 
  StdVectorFst *model = StdVectorFst::Read("model.fst");

  // The FSTs must be sorted along the dimensions they will be joined.
  // In fact, only one needs to be so sorted.
  // This could have instead been done for "model.fst" when it was created. 
  ArcSort(input, StdOLabelCompare());
  ArcSort(model, StdILabelCompare());

  // Container for composition result. 
  StdVectorFst result;

  // Creates the composed FST. 
  Compose(*input, *model, &result);

  // Just keeps the output labels. 
  Project(&result, PROJECT_OUTPUT);

  // Writes the result FST to a file.
  result.Write("result.fst");
}

它给出以下错误

Openfstexample.cpp:1:24: fatal error: fst/fstlib.h: No such file or directory
compilation terminated.

请注意,我已经从http://www.openfst.org/安装了 Openfst

有什么线索吗?

4

1 回答 1

0

编译时需要链接 openfst 库。

尝试:

gcc -lfst <filename>

[确保您已将库安装在 /usr/local/lib 中]

或尝试:

gcc -L /usr/local/lib/libfst.dylib <filename>
于 2018-07-18T23:32:33.410 回答