Login  Register

Compilation problem with g++ 4.8.2

classic Classic list List threaded Threaded
2 messages Options Options
Embed post
Permalink
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Compilation problem with g++ 4.8.2

Dagur Gunnarsson
3 posts
Hello,
 
Is anyone having problems compiling (on linux) a quantlib project using gcc version 4.8.2 ??
I am getting
 
In file included from /usr/include/ql/indexes/inflationindex.hpp:29:0,
                 from /usr/include/ql/cashflows/yoyinflationcoupon.hpp:28,
                 from /usr/include/ql/cashflows/capflooredinflationcoupon.hpp:27,
                 from /usr/include/ql/cashflows/all.hpp:6,
                 from /usr/include/ql/quantlib.hpp:40,
                 from /home/dagur/work/xxx.cpp:1:
/usr/include/ql/termstructures/inflationtermstructure.hpp: In member function ‘bool QuantLib::InflationTermStructure::hasSeasonality() const’:
/usr/include/ql/termstructures/inflationtermstructure.hpp:295:16: error: cannot convert ‘const boost::shared_ptr<QuantLib::Seasonality>’ to ‘bool’ in return
         return seasonality_;
 
The same code compiles fine with gcc 4.7.2 on Fedora 18 64bit

 
regards
Dagur

------------------------------------------------------------------------------
Android is increasing in popularity, but the open development platform that
developers love is also attractive to malware creators. Download this white
paper to learn more about secure code signing practices that can help keep
Android apps secure.
http://pubads.g.doubleclick.net/gampad/clk?id=65839951&iu=/4140/ostg.clktrk
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
| More
Print post
Permalink

Re: Compilation problem with g++ 4.8.2

Luigi Ballabio
3579 posts
Hello,
    gcc 4.8 is probably in C++11 mode and has rejected the implicit
cast to bool.
Try replacing the offending line with

    return static_cast<bool>(seasonality_);

instead. (The fix is in the git repository already, but it hasn't made
its way into a release yet.)

Luigi



On Thu, Oct 31, 2013 at 1:39 PM, Dagur Gunnarsson <[hidden email]> wrote:

> Hello,
>
> Is anyone having problems compiling (on linux) a quantlib project using gcc
> version 4.8.2 ??
> I am getting
>
> In file included from /usr/include/ql/indexes/inflationindex.hpp:29:0,
>                  from /usr/include/ql/cashflows/yoyinflationcoupon.hpp:28,
>                  from
> /usr/include/ql/cashflows/capflooredinflationcoupon.hpp:27,
>                  from /usr/include/ql/cashflows/all.hpp:6,
>                  from /usr/include/ql/quantlib.hpp:40,
>                  from /home/dagur/work/xxx.cpp:1:
> /usr/include/ql/termstructures/inflationtermstructure.hpp: In member
> function ‘bool QuantLib::InflationTermStructure::hasSeasonality() const’:
> /usr/include/ql/termstructures/inflationtermstructure.hpp:295:16: error:
> cannot convert ‘const boost::shared_ptr<QuantLib::Seasonality>’ to ‘bool’ in
> return
>          return seasonality_;
>
> The same code compiles fine with gcc 4.7.2 on Fedora 18 64bit
>
>
> regards
> Dagur
>
> ------------------------------------------------------------------------------
> Android is increasing in popularity, but the open development platform that
> developers love is also attractive to malware creators. Download this white
> paper to learn more about secure code signing practices that can help keep
> Android apps secure.
> http://pubads.g.doubleclick.net/gampad/clk?id=65839951&iu=/4140/ostg.clktrk
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>



--
<https://implementingquantlib.blogspot.com>
<https://twitter.com/lballabio>

------------------------------------------------------------------------------
Android is increasing in popularity, but the open development platform that
developers love is also attractive to malware creators. Download this white
paper to learn more about secure code signing practices that can help keep
Android apps secure.
http://pubads.g.doubleclick.net/gampad/clk?id=65839951&iu=/4140/ostg.clktrk
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users