If one wants to build an example in Xcode, he needs to follow the steps given below. Here it is assumed that Xcode has been configured in that C++ coding is supported.
1. Create a Xcode project
2. Add the example cpp file to this project.
3. Important: - setting path for other Quantlib and Boost headers and Quantlib libraries.
1) Go to Build Settings of the project. Under Search Paths, add path /opt/local/include/ and path /opt/local/include/boost to Header Search Paths.
2) Also under Search Paths, add path /opt/local/lib/ to Library Search Paths.
3) For all the three paths, select non-recursive when each of them is added.
4) Go to Linking. Add -lQuantLib to Other Linker Flags.
Then, the example will be able to built and run in Xcode.
Hope it helps.
Regards,
Bo
Thanks for the responses.Bo, I think compiling c++ is ok, because I can compile a simple program in Xcode and using command line tool.Cheng, Is that a flag I have to add to the compilation command? If so could you please tell me know I should write?Thanks, Sakeeb
On 22 Jul 2014, at 08:40, Cheng Li <[hidden email]> wrote:Seems the error message complains boost unit test lib can't be linked. You have to explicitly tell compiler you want to link with boost unit test lib in your last step.But I am a little wondering why example bermudanswaption has to use unit test lib? Maybe my answer is not right... I have no experience on Mac.
发自我的 iPadHi, I have tried following the instructions on http://quantlib.org/install/macosx.shtml. I’m on OS 10.9.4. I am completely new to all of this so not knowing what info is useful, I listed all the steps I took below. Please could you help me get this working? Thanks in advance for any help.1) Got macports2) sudo port install boost- first time it did a bunch of stuff, now when I tried it again it returns:---> Computing dependencies for boost---> Cleaning boost---> Scanning binaries for linking errors---> No broken files found.3) From sourceforge I downloaded QuantLib-1.4.tar.gz … it saved in my Downloads directory4) In Downloads I ran tar xzvf QuantLib-1.4.tar.gz5) Then there was a QuantLib-1.4 directory within Downloads6) In the QuantLib-1.4 directory: ./configure --enable-static --with-boost-include=/opt/local/include/ \--with-boost-lib=/opt/local/lib/ --prefix=/opt/local/Note: I also tried doing:./configure --enable-static --with-boost-include=/opt/local/include/ \--with-boost-lib=/opt/local/lib/ --prefix=/opt/local/ \CXXFLAGS="-stlib=libstdc++ -mmacosx-version-min=10.6" \LDFLAGS="-stlib=libstdc++ -mmacosx-version-min=10.6”But this doesn’t do much, returning:checking for a BSD-compatible install... /usr/bin/install -cchecking whether build environment is sane... yeschecking for a thread-safe mkdir -p... config/install-sh -c -dchecking for gawk... nochecking for mawk... nochecking for nawk... nochecking for awk... awkchecking whether make sets $(MAKE)... yeschecking whether make supports nested variables... yeschecking for gawk... (cached) awkchecking for gcc... gccchecking whether the C compiler works... noconfigure: error: in `/Users/myname/Downloads/QuantLib-1.4':configure: error: C compiler cannot create executablesSee `config.log' for more details6) make && sudo make install7) runs for about 90mins and asks for my password once while doing so8) Finally when I try compiling within ~/Downloads/QuantLib-1.4/test-suite directory with: g++ -I/opt/local/include/ -I/opt/local/include/boost BermudanSwaption.cpp \-o bermudanswaption -L/opt/local/lib/ -lQuantLibI get:Undefined symbols for architecture x86_64:"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-7aa50d.oQuantLib::detail::quantlib_test_case::operator()() const in BermudanSwaption-7aa50d.o"boost::unit_test::test_suite::add(boost::unit_test::test_unit*, unsigned long, unsigned int)", referenced from:BermudanSwaptionTest::suite() in BermudanSwaption-7aa50d.o"boost::unit_test::test_suite::test_suite(boost::unit_test::basic_cstring<char const>)", referenced from:BermudanSwaptionTest::suite() in BermudanSwaption-7aa50d.o"boost::unit_test::unit_test_log_t::set_checkpoint(boost::unit_test::basic_cstring<char const>, unsigned long, boost::unit_test::basic_cstring<char const>)", referenced from:BermudanSwaptionTest::testCachedValues() in BermudanSwaption-7aa50d.oQuantLib::detail::quantlib_test_case::operator()() const in BermudanSwaption-7aa50d.o"boost::unit_test::unit_test_log_t::operator()(boost::unit_test::log_level)", referenced from:BermudanSwaptionTest::testCachedValues() in BermudanSwaption-7aa50d.o"boost::unit_test::unit_test_log_t::operator<<(boost::unit_test::log::begin const&)", referenced from:BermudanSwaptionTest::testCachedValues() in BermudanSwaption-7aa50d.o"boost::unit_test::test_case::test_case(boost::unit_test::basic_cstring<char const>, boost::unit_test::callback0<boost::unit_test::ut_detail::unused> const&)", referenced from:boost::unit_test::make_test_case(boost::unit_test::callback0<boost::unit_test::ut_detail::unused> const&, boost::unit_test::basic_cstring<char const>) in BermudanSwaption-7aa50d.o"boost::unit_test::ut_detail::entry_value_collector::~entry_value_collector()", referenced from:BermudanSwaptionTest::testCachedValues() in BermudanSwaption-7aa50d.o"boost::unit_test::ut_detail::normalize_test_case_name(boost::unit_test::basic_cstring<char const>)", referenced from:boost::unit_test::make_test_case(boost::unit_test::callback0<boost::unit_test::ut_detail::unused> const&, boost::unit_test::basic_cstring<char const>) in BermudanSwaption-7aa50d.o"QuantLib::flatRate(QuantLib::Date const&, double, QuantLib::DayCounter const&)", referenced from:BermudanSwaptionTest::testCachedValues() in BermudanSwaption-7aa50d.o"boost::unit_test::ut_detail::entry_value_collector::operator<<(boost::unit_test::lazy_ostream const&) const", referenced from:BermudanSwaptionTest::testCachedValues() in BermudanSwaption-7aa50d.o"vtable for boost::unit_test::unit_test_log_t", referenced from:boost::unit_test::unit_test_log_t::unit_test_log_t() in BermudanSwaption-7aa50d.oNOTE: a missing vtable usually means the first non-inline virtual member function has no definition."_main", referenced from:implicit entry/start for main executableld: symbol(s) not found for architecture x86_64------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Free forum by Nabble | Disable Popup Ads | Edit this page |