Posted by
Luigi Ballabio-3 on
Jul 04, 2001; 2:55pm
URL: http://quantlib.414.s1.nabble.com/FiniteDifferenceEuropean-tp1710p1712.html
Hi Gilbert,
I'm cc-ing this to the QL list in case it is of any use to others.
The error didn't have anything to do with the Call thing: it is merely
another case of Microsoft not even being compatible with itself :)
In short, 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.
The setting is in the project settings, "C/C++" tab, "Code Generation"
category. You'll probably want to check the "Use RTTI" option under the
"C++ Language" category, too.
Also, the pricer you're using - like every other in the library, if I'm not
mistaken - takes rates and volatilities in decimal form (you'll have to
pass 0.05 for 5%) and residual times as fraction of years, so that the
arguments you'll pass below don't make much sense as they are (as a matter
of fact, they'll raise an exception). You'll be better off with something like:
FiniteDifferenceEuropean fde(
QuantLib::Option::Call,
100, // underlying
100, // strike
0.0, // no dividend yield
0.05, // 5% risk free rate
1.0, // 1 year
0.1); // 10% volatility
Bye,
Luigi
At 01:38 PM 7/4/01 +0200, Gilbert Peffer wrote:
>Hi Luigi,
>I'm on Windows2000 and use VC++ 6.0. Below is the code and the error message
>as it is thrown from the linker.
>Thanks a lot for your help, Gilbert
>
>
>#define QL_DEBUG
>#include "ql/Pricers/finitedifferenceeuropean.hpp"
>
>void main()
>{
> using QuantLib::Pricers::FiniteDifferenceEuropean;
>
> FiniteDifferenceEuropean fde(
> QuantLib::Option::Call,
> 100,
> 100,
> 0,
> 5,
> 100,
> 10);
>}
>
>Linking...
>MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: "public: virtual __thiscall
>exception::~exception(void)" (??1exception@@UAE@XZ) already defined in
>LIBCD.lib(stdexcpt.obj)
>MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: "public: __thiscall
>exception::exception(void)" (??0exception@@QAE@XZ) already defined in
>LIBCD.lib(stdexcpt.obj)
>MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: "public: __thiscall
>exception::exception(class exception const &)" (??0exception@@QAE@ABV0@@Z)
>already defined in LIBCD.lib(stdexcpt.obj)
>MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _sprintf already defined in
>LIBCD.lib(sprintf.obj)
>MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _tolower already defined in
>LIBCD.lib(tolower.obj)
>LINK : warning LNK4098: defaultlib "MSVCRTD" conflicts with use of other
>libs; use /NODEFAULTLIB:library
>Debug/QuantLibExamples.exe : fatal error LNK1169: one or more multiply
>defined symbols found
>Error executing link.exe.