how does one use QuantLib in a new Visual Studio project? (basic question)

View: New views
13 Messages — Rating Filter:   Alert me  

how does one use QuantLib in a new Visual Studio project? (basic question)

by Nick Procyk :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,
I've successfully compiled QuantLib-0.9.0 and Boost using Visual Studio 2008, and can run the examples.  I want to create my own VS 2008 Win32 console project that combines my finite difference C++ code with QuantLib's.  I tried to copy and paste my code into EquityOption but that didn't work.  Is there any documentation that specifies a step-by-step how to use QL in a new VS project?
 
Thanks,
Nick
 

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
QuantLib-users mailing list
QuantLib-users@...
https://lists.sourceforge.net/lists/listinfo/quantlib-users

Re: how does one use QuantLib in a new Visual Studioproject? (basic question)

by Fabrice_CBA :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Nick,
 
What you should do to make it work is:
    - Open the Quantlib solution
    - Right-click - Add a new Win 32 console project
    - Right click on the newly created project - Project dependancies - Check Quantlib.
    - Right-Click - Properties - C/C++ - Additional Include directories - add ...\Quantlib-0.9.0
    - Right-Click - Properties - Linker - Additional Library directories - add ...\Quantlib-0.9.0\lib
    - Include necessary headers and write a test main.
 
Some of this steps may be unecessary or redundant though.
Furthermore, you might want to create your project in a different solution, in that case you do the same thing you did when linking boost to Quantlib, the 3rd step is then useless.
 
Attached you will find a very small example to call the Sobol number generator.
 
Note that when I did that myself, there was a point I couldn't make it compile without including auto_link.hpp. It now works fine wihtout it, but I don't know exactly why adding it at some point solved a problem. If somebody can enlighten me...
 
Bonne chance,
Fabrice


From: quantlib-users-bounces@... [mailto:quantlib-users-bounces@...] On Behalf Of Nick Procyk
Sent: Monday, 14 April 2008 9:49 PM
To: quantlib-users@...
Subject: [Quantlib-users] how does one use QuantLib in a new Visual Studioproject? (basic question)

Hi,
I've successfully compiled QuantLib-0.9.0 and Boost using Visual Studio 2008, and can run the examples.  I want to create my own VS 2008 Win32 console project that combines my finite difference C++ code with QuantLib's.  I tried to copy and paste my code into EquityOption but that didn't work.  Is there any documentation that specifies a step-by-step how to use QL in a new VS project?
 
Thanks,
Nick
 
************** IMPORTANT MESSAGE *****************************       
This e-mail message is intended only for the addressee(s) and contains information which may be
confidential. 
If you are not the intended recipient please advise the sender by return email, do not use or
disclose the contents, and delete the message and any attachments from your system. Unless
specifically indicated, this email does not constitute formal advice or commitment by the sender
or the Commonwealth Bank of Australia (ABN 48 123 123 124) or its subsidiaries. 
We can be contacted through our web site: commbank.com.au. 
If you no longer wish to receive commercial electronic messages from us, please reply to this
e-mail by typing Unsubscribe in the subject line. 
**************************************************************




-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
QuantLib-users mailing list
QuantLib-users@...
https://lists.sourceforge.net/lists/listinfo/quantlib-users

Quantlib_Test.cpp (830 bytes) Download Attachment

Re: how does one use QuantLib in a new Visual Studioproject? (basic question)

by Eric Ehlers-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Fabrice,

> Note that when I did that myself, there was a point I couldn't
> make it
> compile without including auto_link.hpp. It now works fine
> wihtout it,
> but I don't know exactly why adding it at some point solved a
> problem.
> If somebody can enlighten me...

There are 3 ways to link QL into your project:

1) #include <ql/auto_link.hpp> - this directive appears in
quantlib.hpp.

2) List the QuantLib static library explicitly in your
project's link dependencies.  Not convenient nor recommended,
because the QL lib has a different name under each
configuration, e.g. QuantLib-vc80-mt-s-0_9_0.lib for Release,
QuantLib-vc80-mt-0_9_0.lib for Release CRTDLL, etc.

3) If your project and QuantLib reside in the same VC solution
file, and if you make the former dependent on the latter as you
explained in your message, then VC automatically gets the link
dependencies right even in the absence of 1) and 2).

If you needed 1) initially but don't any longer, maybe it's
because you implemented 3) in the interim.

Bonne journée,
Eric



-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
QuantLib-users mailing list
QuantLib-users@...
https://lists.sourceforge.net/lists/listinfo/quantlib-users

Re: how does one use QuantLib in a new Visual Studioproject? (basic question)

by Fabrice_CBA :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thank you very much Erik for that.

I played around with my configuration and you were right, I added 3) after doing 1).

So if I understand well, including auto_link.hpp is the best way when you have an external project, setting the dependancies is another way when the project is in the same solution.

Merci,
Fabrice

-----Original Message-----
From: Eric Ehlers [mailto:eric.ehlers@...]
Sent: Tuesday, 15 April 2008 10:16 PM
To: Lecuyer, Fabrice
Cc: quantlib-users@...
Subject: Re: [Quantlib-users] how does one use QuantLib in a new Visual Studioproject? (basic question)

Hi Fabrice,

> Note that when I did that myself, there was a point I couldn't make it
> compile without including auto_link.hpp. It now works fine wihtout it,
> but I don't know exactly why adding it at some point solved a problem.
> If somebody can enlighten me...

There are 3 ways to link QL into your project:

1) #include <ql/auto_link.hpp> - this directive appears in quantlib.hpp.

2) List the QuantLib static library explicitly in your project's link dependencies.  Not convenient nor recommended, because the QL lib has a different name under each configuration, e.g. QuantLib-vc80-mt-s-0_9_0.lib for Release, QuantLib-vc80-mt-0_9_0.lib for Release CRTDLL, etc.

3) If your project and QuantLib reside in the same VC solution file, and if you make the former dependent on the latter as you explained in your message, then VC automatically gets the link dependencies right even in the absence of 1) and 2).

If you needed 1) initially but don't any longer, maybe it's because you implemented 3) in the interim.

Bonne journée,
Eric



************** IMPORTANT MESSAGE *****************************      
This e-mail message is intended only for the addressee(s) and contains information which may be
confidential.
If you are not the intended recipient please advise the sender by return email, do not use or
disclose the contents, and delete the message and any attachments from your system. Unless
specifically indicated, this email does not constitute formal advice or commitment by the sender
or the Commonwealth Bank of Australia (ABN 48 123 123 124) or its subsidiaries.
We can be contacted through our web site: commbank.com.au.
If you no longer wish to receive commercial electronic messages from us, please reply to this
e-mail by typing Unsubscribe in the subject line.
**************************************************************




-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
QuantLib-users mailing list
QuantLib-users@...
https://lists.sourceforge.net/lists/listinfo/quantlib-users

SWIGTYPE question

by Harun Özkan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Dear all,

I am trying to utilize QuantlibSWIG.0.9.0. And, I encountered a problem when
using Cashflows.bps(). It requires a strange arguement,
SWIGTYPE_p_YieldTermStructure.
I could not understand that object.

Does anyone have idea about what it is and how to overcome it?

All the best.
Harun.


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
QuantLib-users mailing list
QuantLib-users@...
https://lists.sourceforge.net/lists/listinfo/quantlib-users

Re: how does one use QuantLib in a new Visual Studioproject? (basic question)

by Eric Ehlers-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, April 16, 2008 09:42, Lecuyer, Fabrice wrote:
> So if I understand well, including auto_link.hpp is the best
> way when you have an external project, setting the dependancies
> is another way when the project is in the same solution.

Exactly!

Bonne journée,
Eric



-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
QuantLib-users mailing list
QuantLib-users@...
https://lists.sourceforge.net/lists/listinfo/quantlib-users

Re: how does one use QuantLib in a new Visual Studioproject? (basic question)

by Nick Procyk :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thank you all!  I did #3 successfully.
 
Nick

On Wed, Apr 16, 2008 at 4:42 AM, Lecuyer, Fabrice <Fabrice.Lecuyer@...> wrote:
Thank you very much Erik for that.

I played around with my configuration and you were right, I added 3) after doing 1).

So if I understand well, including auto_link.hpp is the best way when you have an external project, setting the dependancies is another way when the project is in the same solution.

Merci,
Fabrice

-----Original Message-----
From: Eric Ehlers [mailto:eric.ehlers@...]
Sent: Tuesday, 15 April 2008 10:16 PM
To: Lecuyer, Fabrice
Cc: quantlib-users@...
Subject: Re: [Quantlib-users] how does one use QuantLib in a new Visual Studioproject? (basic question)

Hi Fabrice,

> Note that when I did that myself, there was a point I couldn't make it
> compile without including auto_link.hpp. It now works fine wihtout it,
> but I don't know exactly why adding it at some point solved a problem.
> If somebody can enlighten me...

There are 3 ways to link QL into your project:

1) #include <ql/auto_link.hpp> - this directive appears in quantlib.hpp.

2) List the QuantLib static library explicitly in your project's link dependencies.  Not convenient nor recommended, because the QL lib has a different name under each configuration, e.g. QuantLib-vc80-mt-s-0_9_0.lib for Release, QuantLib-vc80-mt-0_9_0.lib for Release CRTDLL, etc.

3) If your project and QuantLib reside in the same VC solution file, and if you make the former dependent on the latter as you explained in your message, then VC automatically gets the link dependencies right even in the absence of 1) and 2).

If you needed 1) initially but don't any longer, maybe it's because you implemented 3) in the interim.

Bonne journée,
Eric



************** IMPORTANT MESSAGE *****************************
This e-mail message is intended only for the addressee(s) and contains information which may be
confidential.
If you are not the intended recipient please advise the sender by return email, do not use or
disclose the contents, and delete the message and any attachments from your system. Unless
specifically indicated, this email does not constitute formal advice or commitment by the sender
or the Commonwealth Bank of Australia (ABN 48 123 123 124) or its subsidiaries.
We can be contacted through our web site: commbank.com.au.
If you no longer wish to receive commercial electronic messages from us, please reply to this
e-mail by typing Unsubscribe in the subject line.
**************************************************************




-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
QuantLib-users mailing list
QuantLib-users@...
https://lists.sourceforge.net/lists/listinfo/quantlib-users


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
QuantLib-users mailing list
QuantLib-users@...
https://lists.sourceforge.net/lists/listinfo/quantlib-users

Re: SWIGTYPE question

by Luigi Ballabio :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, 2008-04-16 at 15:22 +0300, Harun Özkan wrote:
> I am trying to utilize QuantlibSWIG.0.9.0. And, I encountered a problem when
> using Cashflows.bps(). It requires a strange arguement,
> SWIGTYPE_p_YieldTermStructure.
> I could not understand that object.

The strange name is a SWIG artifact. It seems that we've forgotten to
check that function, but there might be a workaround. Do you have a term
structure in your script? How did you instantiate it?

Luigi


--

Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it.
-- Brian W. Kernighan



-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
QuantLib-users mailing list
QuantLib-users@...
https://lists.sourceforge.net/lists/listinfo/quantlib-users

Parent Message unknown Re: SWIGTYPE question

by Luigi Ballabio :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Apr 18, 2008, at 8:28 PM, Harun Özkan wrote:
> Yes, I have a YieldTermStructure and I have initialized it properly;
> without a "SWIGTYPE_p_" prefix. Other classes, that take
> YieldTermStructure in their arguements are working properly.
> Nonetheless, Cashflows.bps() requires SWIGTYPE_p_YieldTermStructure
> and does not accept YieldTermStructure.

Hmm. We'll have to fix that. In the meantime, there should be a
workaround---but I forgot to ask: what language are you using? The
workaround might depend on that.

Luigi

P.S. Please CC the mailing list for future reference, in case someone
else runs into the same problem



-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
QuantLib-users mailing list
QuantLib-users@...
https://lists.sourceforge.net/lists/listinfo/quantlib-users

Re: SWIGTYPE question

by Harun Özkan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

CSharp.
Thank you.

----- Original Message -----
From: "Luigi Ballabio" <luigi.ballabio@...>
To: "Harun Özkan" <harunozkan@...>
Cc: "QuantLib users" <quantlib-users@...>
Sent: Friday, April 18, 2008 10:28 PM
Subject: Re: [Quantlib-users] SWIGTYPE question



On Apr 18, 2008, at 8:28 PM, Harun Özkan wrote:
> Yes, I have a YieldTermStructure and I have initialized it properly;
> without a "SWIGTYPE_p_" prefix. Other classes, that take
> YieldTermStructure in their arguements are working properly. Nonetheless,
> Cashflows.bps() requires SWIGTYPE_p_YieldTermStructure and does not accept
> YieldTermStructure.

Hmm. We'll have to fix that. In the meantime, there should be a
workaround---but I forgot to ask: what language are you using? The
workaround might depend on that.

Luigi

P.S. Please CC the mailing list for future reference, in case someone
else runs into the same problem



-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
QuantLib-users mailing list
QuantLib-users@...
https://lists.sourceforge.net/lists/listinfo/quantlib-users

Re: SWIGTYPE question

by Luigi Ballabio :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri, 2008-04-18 at 23:13 +0300, Harun Özkan wrote:
> CSharp.
> Thank you.

Ok. In next release, you'll be able to pass your term structure
directly. In the meantime, if you have a YieldTermStructure instance ts,
you can pass ts.__deref__() to the function.

Luigi


>
> ----- Original Message -----
> On Apr 18, 2008, at 8:28 PM, Harun Özkan wrote:
> > Yes, I have a YieldTermStructure and I have initialized it properly;
> > without a "SWIGTYPE_p_" prefix. Other classes, that take
> > YieldTermStructure in their arguements are working properly. Nonetheless,
> > Cashflows.bps() requires SWIGTYPE_p_YieldTermStructure and does not accept
> > YieldTermStructure.
>
> Hmm. We'll have to fix that. In the meantime, there should be a
> workaround---but I forgot to ask: what language are you using? The
> workaround might depend on that.


--

Olmstead's Law:
After all is said and done, a hell of a lot more is said
than done.



-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
QuantLib-users mailing list
QuantLib-users@...
https://lists.sourceforge.net/lists/listinfo/quantlib-users

Re: SWIGTYPE question

by Harun Özkan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks Luigi. I'll send the list of all those SWIG artifacts to the list in
a short time.

By the way, if I have a YieldTermStructure instance ts,
ts.__deref__()    doesn't pass
but
ts.__deref__().__deref__()  does.

Best wishes
Harun.


----- Original Message -----
From: "Luigi Ballabio" <luigi.ballabio@...>
To: "Harun Özkan" <harunozkan@...>
Cc: "QuantLib users" <quantlib-users@...>
Sent: Monday, April 21, 2008 12:56 PM
Subject: Re: [Quantlib-users] SWIGTYPE question


On Fri, 2008-04-18 at 23:13 +0300, Harun Özkan wrote:
> CSharp.
> Thank you.

Ok. In next release, you'll be able to pass your term structure
directly. In the meantime, if you have a YieldTermStructure instance ts,
you can pass ts.__deref__() to the function.

Luigi


>
> ----- Original Message -----
> On Apr 18, 2008, at 8:28 PM, Harun Özkan wrote:
> > Yes, I have a YieldTermStructure and I have initialized it properly;
> > without a "SWIGTYPE_p_" prefix. Other classes, that take
> > YieldTermStructure in their arguements are working properly.
> > Nonetheless,
> > Cashflows.bps() requires SWIGTYPE_p_YieldTermStructure and does not
> > accept
> > YieldTermStructure.
>
> Hmm. We'll have to fix that. In the meantime, there should be a
> workaround---but I forgot to ask: what language are you using? The
> workaround might depend on that.


--

Olmstead's Law:
After all is said and done, a hell of a lot more is said
than done.



-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
QuantLib-users mailing list
QuantLib-users@...
https://lists.sourceforge.net/lists/listinfo/quantlib-users

Re: SWIGTYPE question

by Luigi Ballabio :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, 2008-04-21 at 13:54 +0300, Harun Özkan wrote:
> Thanks Luigi. I'll send the list of all those SWIG artifacts to the list in
> a short time.
>
> By the way, if I have a YieldTermStructureHandle instance ts,
> ts.__deref__()    doesn't pass
> but
> ts.__deref__().__deref__()  does.

Yes. I've added overloads for those as well. They'll be in next release.

Luigi


--

A child of five would understand this. Send someone to fetch a child of
five.
-- Groucho Marx



-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
QuantLib-users mailing list
QuantLib-users@...
https://lists.sourceforge.net/lists/listinfo/quantlib-users