This is off-topic and maybe belongs to StackOverflow, but here goes.
1. Compile QuantLib
The best way is to open the Visual Studio Command Prompt using a shortcut under Programs→Microsoft Visual Studio→Visual Studio Tools. Now, you need to navigate to the
QuantLib folder inside the folder where you have QuantLib (there are other folders such as
QuantLibXL – that’s not the one you need.
Now, compile the whole of QuantLib by running the following command:
msbuild /t:Rebuild /p:Configuration=Release QuantLib_vc10.sln.
Inside this folder, if you look in the
lib folder, you’ll get a lib file called
QuantLib-vc<VER>-mt.lib and a corresponding file with a
-gd suffix. You need these libs as well as the headers.
2. Configure headers
Right-click the project and choose Properties. Now, make sure you choose All Configurations in the configuration drop-down list box on the top-left of the window.
First, navigate to ConfigurationProperties→C/C++→General. In the Additional Include Directories, add the path to QuantLib’s directory. If you add the
<QL Root>\QuantLib directory, you will be able to reference QuantLib headers with statements such as
#include <ql/someheader.hpp>. If you did it correctly and you’re using VS2010, IntelliSense will kick in immediately, meaning if you type
#include <ql/, VS will show you a helper list with headers (which is useful).
3. Configure library references
Now, navigate down to Configuration Properties→Linker→General. In the Additional Library Directories add the path to the QuantLib’s
Now move down to the Input header under the Linker header. Edit the Additional Dependencies field, prepending it with the name of the QuantLib library file — you need to specify the filename (without the full path) of the
.lib file you need to include. The
-mt.lib file is used for the Release build, and the
-mt-gd.lib for the Debug build. If you mess these up, you'll get errors.
4. Run it
By now, assuming you have the boost libraries in your VS
\include folder, the following should compile and run without problem:
//first line is required in .NET
using namespace std;
using namespace QuantLib;
boost::shared_ptr<Money> m(new Money);
cout << m->value() << endl;