can not compile using provided code

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

can not compile using provided code

PAEdwards
Hi all

I am a rookie in QuantLib and Unix, so please accept my apology for this entry level question.

I just follow the instructions listed on QuantLib install website

http://quantlib.org/install/macosx.shtml

and successfully (I hope so) install Boost 1.50.0 and QuantLib 1.0.1 on a Mac OS X 10.6 .   After that I got trouble in compiling the provided example:

g++ -I/opt/local/include/ -I/opt/local/include/boost BermudanSwaption.cpp \
    -o bermudanswaption -L/opt/local/lib/ -lQuantLib


and got a huge error message looks like:

"Undefined symbols:
  "boost::unit_test::test_suite::add(boost::unit_test::test_unit*, unsigned long, unsigned int)", referenced from:
      BermudanSwaptionTest::suite()      in BermudanSwaption.o
  "boost::unit_test::unit_test_log_t::operator()(boost::unit_test::log_level)", referenced from:
      BermudanSwaptionTest::testCachedValues()       in BermudanSwaption.o
  "boost::test_tools::tt_detail::check_impl(boost::test_tools::predicate_result const&, boost::unit_test::lazy_ostream const&, boost::unit_test::basic_cstring<char const>, unsigned long, boost::test_tools::tt_detail::tool_level, boost::test_tools::tt_detail::check_type, unsigned long, ...)", referenced from:
      BermudanSwaptionTest::testCachedValues()       in BermudanSwaption.o".........
......
......

Can any one help to figure out what happened here? Thank you very much for your help!

Allen
Reply | Threaded
Open this post in threaded view
|

Re: can not compile using provided code

Luigi Ballabio
Hi,
    I hope you solved this already (I'm reading this only now).
Anyway: from the error messages, it seems that you're not compiling
the example (the one in the Examples/BermudanSwaption folder) but the
file containing the test suite for the swaptions (which is in the
test-suite folder).  The one you're using is not supposed to be
compiled by itself, but together with the other files in the same
folder; and furthermore, it needs the Boost unit-test library, which
you're not passing to the compiler.  If you really want to run the
test suite, it was already compiled when you ran "make"; if you want
the example instead, your command line should work if you run it in
the right folder.

Luigi

On Sat, Aug 4, 2012 at 1:14 AM, PAEdwards <[hidden email]> wrote:

>
> Hi all
>
> I am a rookie in QuantLib and Unix, so please accept my apology for this
> entry level question.
>
> I just follow the instructions listed on QuantLib install website
>
> http://quantlib.org/install/macosx.shtml
>
> and successfully (I hope so) install Boost 1.50.0 and QuantLib 1.0.1 on a
> Mac OS X 10.6 .   After that I got trouble in compiling the provided
> example:
>
> g++ -I/opt/local/include/ -I/opt/local/include/boost BermudanSwaption.cpp \
>     -o bermudanswaption -L/opt/local/lib/ -lQuantLib
>
> and got a huge error message looks like:
>
> "Undefined symbols:
>   "boost::unit_test::test_suite::add(boost::unit_test::test_unit*, unsigned
> long, unsigned int)", referenced from:
>       BermudanSwaptionTest::suite()      in BermudanSwaption.o
>
> "boost::unit_test::unit_test_log_t::operator()(boost::unit_test::log_level)",
> referenced from:
>       BermudanSwaptionTest::testCachedValues()       in BermudanSwaption.o
>
> "boost::test_tools::tt_detail::check_impl(boost::test_tools::predicate_result
> const&, boost::unit_test::lazy_ostream const&,
> boost::unit_test::basic_cstring<char const>, unsigned long,
> boost::test_tools::tt_detail::tool_level,
> boost::test_tools::tt_detail::check_type, unsigned long, ...)", referenced
> from:
>       BermudanSwaptionTest::testCachedValues()       in
> BermudanSwaption.o".........
> ......
> ......
>
> Can any one help to figure out what happened here? Thank you very much for
> your help!
>
> Allen
> --
> View this message in context: http://old.nabble.com/can-not-compile-using-provided-code-tp34253241p34253241.html
> Sent from the quantlib-users mailing list archive at Nabble.com.
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users