Setting up OpenFst 1.2.7 with Visual Studio

1 Obtain (and Build) the OpenFst binaries

Download the pre-built 1.2.7 binaries and source from:

If you want to rebuild from source then, open the solution openfstwin.sln in Visual Studio 2010 and build the Debug and/or Release configurations. This will build all the command lines and OpenFst dll for the selected configurations.

2 Set PATH variables

Add the openfstwin Release and/or Debug sub-directories to the system or user PATH variable.  (Control Panel\System and Security\System, Advanced System Settings->Advanced, Environment). This allows the system to find the OpenFst dlls when an executable is run.

3 Create new project

Use the C++ project wizard to create an empty Win32 Console Application and give it name for example fsttest.


Create a Console application and select Empty project


4 Create a Property Page for OpenFst or set paths

Unfortunately Microsoft removed the Global include/lib/bin options from Visual Studio 2010. This means we have to setup the OpenFfst include and lib directories for every project. There are two workarounds to make thing easier for subsequent project . Set the INCLUDE and LIBPATH variables (vis Control Panel\System and Security\System, Advanced System Settings->Advanced, Environment).


An alternative re-usable workaround is to a Property Sheet for the OpenFst directories and re-use it for all the new projects. This technique has the advantage that intellisense will work for the OpenFst library.

Go to  the Property Manager [View->Property Manager], and then right click on any project node and select properties from the context menu.

Add a new property sheet but store it somewhere for use in other project. In this example the property sheet is called openfst.


5 Setup the C++ Directory Paths

Next right click one of openfst.prop nodes and select properties. Go to C++ General and Open [Additional Include Directories]

Add the full path to the OpenFst include to the “Include Directories” and both the Debug and Release folders to the “Library Directory”


This version of OpenFstWin uses the auto-linking support in Visual Studio and therefore it is not necessary to manual set a reference to the library or dll. The debug dll is names openfst-gd.lib/dll andthe release builds are openfst.lib/dll.

Note it is essential to link the correct version (the auto-linking should handle this for you anyway) otherwise the incompatibilities between the iterator debugging for the two builds will cause incomprehensible crashes. In addition do not disable iterator debugging in your client applications debug builds (or enable it in release) without making the necessary changes to the core OpenFst visual builds.

After setting the environment variables everything should happen automatically!



The debug build will generate debug information so it will become possible to step into the library cc files. All of the algorithm are implemented as header files. The symbol table and parts of the FST IO routines are in cc files, if you do not need to step into this code you can skip this step.

To add the debug Tools->Options->Debugging->Symbols and add the path to the OpenFst debug.



Will all these setting you can add a C++ code files to your project and build and debug against OpenFst.

This entry was posted by Edobashira. Bookmark the permalink.

6 thoughts on “Setting up OpenFst 1.2.7 with Visual Studio”

Leave a Reply

Note: only a member of this blog may post a comment.