Nov 14

Using Spirit V2.1 With Older Versions of Boost (pre V1.41)

By Hartmut Kaiser Add comments

Would you like to try the new version of Spirit but you are stuck with an older version of Boost? If yes, don’t despair, there might be help!

The new version of Spirit has been written to be compatible with all versions of Boost starting with V1.37 (which has been released roughly a year ago). So, if the Boost version you have to work with is not older than that you might want to read on.

As you might already know, Spirit is a header only library. No source files have to be (pre-)compiled in order to use it. This feature makes it very easy to integrate the library into any build system. Just add the directory where Spirit’s headers are located to the list of directories your compiler uses to look for files to include (the compiler’s include search path).

For older versions of Boost this directory needs to be placed on the compiler search path in front of your Boost include directory so the compiler will find the newer Spirit header files instead of the ones included with Boost. Let’s assume you unpacked Spirit in a directory of your choice <yourdir> (while preserving the directory structure underneath: <yourdir>/boost/spirit/…) then for most compilers this amounts to adding a command line option: -I<yourdir>.

The last question to answer is where to get Spirit V2.1. Well, either download Boost V1.41 and extract the Spirit directories (there are two subdirectories you might be interested in: …/boost/spirit/… and …/libs/spirit/) from the archive. The other option is to simply download from here:

Both files contain a snapshot of the files related to Spirit taken from the Boost V1.41 release archives). The only thing to watch out is that these files will not be usable without any existing Boost installation.

Happy hacking!

Leave a Reply

preload preload preload