Search code examples
c++linuxshellopenfst

C++/OpenFST - Error on Finding Library and Linking


In OpenFST web site it says that;

The OpenFst library is a C++ template library. From C++, include in the installation include directory and link to libfst.so in the installation library directory.

My code consists of only this for the sake of simplicity;

#include <fst/fstlib.h>
#include <iostream>
int main(){
}

I have fstlib.h under /home/me/usr/include/fst and libfst.so under /home/me/usr/lib. I tried this;

$g++ -I/home/me/usr/include/ code.cpp -lfst -L/home/me/usr/lib

Based on this solution.

However I got plenty of errors about not finding library. Like this.

What do you suggest me about it? Thank you.


Solution

  • Try adding -std=gnu++11 to your compilation line:

    $g++ -std=gnu++11 -I/home/me/usr/include/ code.cpp -lfst -L/home/me/usr/lib
    

    Always that you have a similar issue, look for the very first error message that appears on the log when compiling.

    Hope this helps! :-)