1

I am trying to compile following code using gcc in 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");
}

It gives following error

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

Please note that I have already installed Openfst from http://www.openfst.org/

Any clues?

  • 1
    is `fstlib.h` stored at `/usr/local/include` or at `/usr/local/include/fst`? – wimh Oct 20 '14 at 12:51
  • Those files are not there in those directories –  Oct 20 '14 at 12:56
  • Did you try `-I/path/to/fst/installation`? (And are you really trying to compile C++ code with `gcc`?) – Fred Foo Oct 20 '14 at 12:56
  • yes, I am trying to do that @larsmans –  Oct 20 '14 at 13:02
  • Did you use `sudo` to install? ie 'sudo make install'. (This is missing in the [installation manual](http://www.openfst.org/twiki/bin/view/FST/DistInstall)). – wimh Oct 20 '14 at 13:58

1 Answers1

0

You need to link the openfst library while compiling.

Try:

gcc -lfst <filename>

[Make sure you have the library installed in /usr/local/lib]

or Try:

gcc -L /usr/local/lib/libfst.dylib <filename>