Issue
I used to use Quantlib in Visual Studio on Windows, but recently transferred to Fedora Linux. I watched this video of setting up Quantlib in Eclipse On Ubuntu (https://www.youtube.com/watch?v=4NNc9mZ8Nro), but I noticed that in Fedora I could download and install the compiled rpm files for Quantlib and Boost. I would like to know how I can set up Quantlib in Code Blocks on Fedora 25 using these compiled rpm files.
Solution
I haven't used Code::Blocks, but the steps should be the same as for any other library; include in your sources the headers for the features you want to use, link the library with your compiled source, and make headers and libraries available to the compiler.
Starting from the end: the RPMs might have already installed QuantLib header files and libraries where the compiler can find them, so you probably won't have to worry about it. If that's not the case, find out where the RPMs installed QuantLib: headers and libraries might be in /usr/include/
and /usr/lib/
, or /usr/local/include
and /usr/local/lib
. Add the include directory (which must contain the ql
folder) to the include search paths for Code::Blocks, and the library directory (which must contain libQuantLib.*
) to the library search paths.
The page at http://wiki.codeblocks.org/index.php/BoostWindowsQuickRef shows how to do it for Boost (look under the section "Add Boost search directories to your project"); you can do the same for QuantLib.
Once the search directories are set up, you have to include in your sources the QuantLib headers you need; for instance;
#include <ql/time/date.hpp>
if you want to use the Date
class. Finally, add QuantLib to the list of libraries to link to your project. Again, this is done in the same way described for Boost on the page I linked above; look at the section "Include Boost headers and link with Boost libraries".
Answered By - Luigi Ballabio