Usage

To use QuantLib classes in your own code just add
    #include <ql/quantlib.hpp>
at the beginning of your source/header files.

Under the Examples folder you can find examples of QuantLib usage, including makefiles for gcc, Borland Free compiler, and Microsoft Visual C++. For the latter project files are also available.

Microsoft Visual C++

A few suggestions for Visual C++ users wanting to use QuantLib into their own application:
  1. As long as you include ql/quantlib.hpp, you won't have to explicitly link your application to QuantLib.lib (or QuantLib_d.lib). This is automatically done by quantlib.hpp using the pragma statement:
        #ifdef _DEBUG
            #pragma comment(lib,"QuantLib_d.lib")
        #else
            #pragma comment(lib,"QuantLib.lib")
        #endif
    
  2. Your main() must be compiled with the same options that were used in compiling the QuantLib library - namely, you'll have to set the run-time library to "Multithreaded DLL" or "Debug Multithreaded DLL" depending on whether you're linking to QuantLib.lib or QuantLib_d.lib, respectively. This setting is in the project settings, "C/C++" tab, "Code Generation" category. You'll have to check the "Use RTTI" option under the "C++ Language" category, too. Finally, you have to define NOMINMAX
  3. To create your own project, add it to a new or existing Workspace. Under File | New | Projects select "Win32 Console Application" (or equivalent). Under Project | Settings select your project. Select settings for: "All configuration". On the "C/C++" tab select "Preprocessor" and under "Additional include directory" add "\$(QL_DIR)". This will add your current QuantLib installation directory to the include path. On the "Link" tab select "Input" and under "Additional library path" add "\$(QL_DIR)\lib\Win32\VisualStudio\". This will add your current QuantLib installation directory to the library path.
  4. To compile in "Win32 Debug" configuration you will need the QuantLib debug libraries, available for download from http://quantlib.org/download.html
  5. The "Win32 OnTheEdgeRelease" and "Win32 OnTheEdgeDebug" configurations are equivalent to "Win32 Release" and "Win32 Debug" respectively, except that they do not use the installed QuantLib libraries, but look for the hpp and lib QuantLib files in a relative ..\QuantLib path. This is mainly for QuantLib developers, to allow them to check the examples without having to install their unstable working version of QuantLib. The "OnTheEdge" approach may be adopted in projects using QuantLib, allowing for a quick and easy way to check how the projects work with a new QuantLib release without having to install it.

QuantLib.org
QuantLib
Hosted by
SourceForge.net Logo
Documentation generated by
doxygen