Login  Register

Re: Error in compiling of QuantLib examples

Posted by Yannis on Jan 25, 2017; 5:46am
URL: http://quantlib.414.s1.nabble.com/Error-in-compiling-of-QuantLib-examples-tp17991p17992.html

Hi,

I think the problem lies with the line:
cashFlows.emplace_back(SimpleCashFlow(2.0, d1));
The elements in CashFlows are shared_ptr. Therefore you should pass an argument to emplace_back out of which a shared_ptr may be constructed.
So change the above line to: 
cashFlows.emplace_back(new SimpleCashFlow(2.0, d1));
Alternatively use 
cashFlows.push_back( boost::shared_ptr<CashFlow>(new SimpleCashFlow(2.0, d1)) );
Good luck,

Yannis


ziegele <[hidden email]> schrieb am 22:55 Dienstag, 24.Januar 2017:


Hello,

I am a starter of using QuantLib. I'm currently following the tutorial as
shown in  http://cogitolearning.co.uk/?p=332
<http://http://cogitolearning.co.uk/?p=332

The code I wrote in enclosed in attachment. main.cpp
<http://quantlib.10058.n7.nabble.com/file/n17991/main.cpp

If I follow exactly as what's shown in the tutorial, I got an error when
compiling:
<http://quantlib.10058.n7.nabble.com/file/n17991/error1.jpg>

Then I figured out that there might be a typo in the tutorial, so I changed
cashFlows[i].accept(addCashFlowVisitor); to
cashFlows[i]->accept(addCashFlowVisitor);

However, I still got an error when trying to compile:
<http://quantlib.10058.n7.nabble.com/file/n17991/error2.jpg>

I'm wondering how to fix it?

Thanks



--
View this message in context: http://quantlib.10058.n7.nabble.com/Error-in-compiling-of-QuantLib-examples-tp17991.html
Sent from the quantlib-users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users