我正试图在Ubuntu 1004 中使用gcc
编译以下代码
#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.
请注意,我已经从安装了Openfsthttp://www.openfst.org/
有线索吗?
编译时需要链接openfst库。
尝试:
gcc -lfst <filename>
[确保在/usr/local/lib]中安装了库
或尝试:
gcc -L /usr/local/lib/libfst.dylib <filename>