problems linking to quantlib

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

problems linking to quantlib

bryan kelly
Thank you in advance for help on this item.  I have tried googling a number of
times, but I can't find any information on point from google or the mailing
lists.  

I am running SUSE 9.2 linux with g++ 3.3.3 and kdevelop 3.2.1 on KDE 3.4.1.  I
compiled and  installed quantlib without error in the /opt directory, and I
am now trying to ensure that my programs compile and link to quantlib.  I
have been attempting to complie the following simple program, without success
(when I remove references to QuantLib, the program compiles just fine)....
------------------------------------------------------------------------------------------------------------
// the only header you need to use QuantLib
#include <ql/quantlib.hpp>
#include <iostream>
#include <iomanip>

using namespace QuantLib;

int main(int argc, char *argv[])
{
  return EXIT_SUCCESS;
}
------------------------------------------------------------------------------------------------------------

I get quite a number of complier errors (below), and I can't quite figure out
what is causing this.  All of these errors come up during the linking process.  
Does anyone have any ideas?  

There seem to be a fair number of errors associated with undefined references;
however, the line numbers mentioned don't even match up with the items in
question.  

(for instance, the first error below references, date.hpp line 503 does not
contain any reference at all to blackVarianceImpl(double, double) const, yet
an error is returned by the compiler)
--------------------------------------------------------------------------------------------------------------
testquant.o(.gnu.linkonce.r._ZTVN8QuantLib20BlackVarianceSurfaceE+0x38):/opt/quantlib/include/ql/date.hpp:503:
undefined reference to
`QuantLib::BlackVarianceSurface::blackVarianceImpl(double, double) const'
testquant.o(.gnu.linkonce.r._ZTVN8QuantLib15CompoundForwardE+0x30):/opt/quantlib/include/ql/swaptionvolstructure.hpp:104:
undefined reference to `QuantLib::CompoundForward::discountImpl(double)
const'
testquant.o(.gnu.linkonce.r._ZTVN8QuantLib15CompoundForwardE+0x34):/opt/quantlib/include/ql/instrument.hpp:128:
undefined reference to `QuantLib::CompoundForward::forwardImpl(double) const'
testquant.o(.gnu.linkonce.r._ZTVN8QuantLib15CompoundForwardE+0x38):/opt/quantlib/include/ql/date.hpp:503:
undefined reference to `QuantLib::CompoundForward::zeroYieldImpl(double)
const'
testquant.o(.gnu.linkonce.r._ZTVN8QuantLib18BlackVarianceCurveE+0x38):/opt/quantlib/include/ql/date.hpp:503:
undefined reference to
`QuantLib::BlackVarianceCurve::blackVarianceImpl(double, double) const'
testquant.o(.gnu.linkonce.r._ZTVN8QuantLib21InArrearIndexedCouponE+0x34):/opt/quantlib/include/ql/instrument.hpp:128:
undefined reference to
`QuantLib::InArrearIndexedCoupon::convexityAdjustment(double) const'
testquant.o(.gnu.linkonce.r._ZTVN8QuantLib17DiscretizedOptionE+0x1c):/opt/quantlib/include/ql/PricingEngines/Vanilla/mceuropeanengine.hpp:267:
undefined reference to `QuantLib::DiscretizedOption::postAdjustValuesImpl()'
/opt/quantlib/include/ql/Patterns/singleton.hpp:76: undefined reference to
`QuantLib::Calendar::advance(QuantLib::Date const&, int, QuantLib::TimeUnit,
QuantLib::BusinessDayConvention) const'
/usr/include/g++/bits/sstream.tcc:105: undefined reference to
`QuantLib::Error::Error[in-charge](std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&, long,
std::basic_string<char, std::char_traits<char>, std::allocator<char> >
const&, std::basic_string<char, std::char_traits<char>, std::allocator<char>
> const&)'
/opt/quantlib/include/ql/daycounter.hpp:114: undefined reference to `typeinfo
for QuantLib::Error'
/usr/include/g++/bits/sstream.tcc:138: undefined reference to
`QuantLib::Error::Error[in-charge](std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&, long,
std::basic_string<char, std::char_traits<char>, std::allocator<char> >
const&, std::basic_string<char, std::char_traits<char>, std::allocator<char>
> const&)'
testquant.o(.gnu.linkonce.t._ZN8QuantLib17DiscretizedOption5resetEj+0x23a):/usr/include/g++/bits/sstream.tcc:222:
undefined reference to `typeinfo for QuantLib::Error'
/opt/quantlib/include/ql/Math/linearinterpolation.hpp:49: undefined reference
to `QuantLib::Error::Error[in-charge](std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&, long,
std::basic_string<char, std::char_traits<char>, std::allocator<char> >
const&, std::basic_string<char, std::char_traits<char>, std::allocator<char>
> const&)'
/usr/include/g++/bits/vector.tcc:255: undefined reference to `typeinfo for
QuantLib::Error'
/opt/quantlib/include/ql/Optimization/leastsquare.hpp:166: undefined reference
to `QuantLib::Error::Error[in-charge](std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&, long,
std::basic_string<char, std::char_traits<char>, std::allocator<char> >
const&, std::basic_string<char, std::char_traits<char>, std::allocator<char>
> const&)'
/usr/include/g++/bits/sstream.tcc:166: undefined reference to `typeinfo for
QuantLib::Error'
/opt/quantlib/include/ql/FiniteDifferences/shoutcondition.hpp:84: undefined
reference to `QuantLib::Error::Error[in-charge](std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&, long,
std::basic_string<char, std::char_traits<char>, std::allocator<char> >
const&, std::basic_string<char, std::char_traits<char>, std::allocator<char>
> const&)'
testquant.o(.gnu.linkonce.t._ZNK8QuantLib10Instrument19performCalculationsEv+0x528):/opt/quantlib/include/ql/FiniteDifferences/shoutcondition.hpp:84:
undefined reference to `typeinfo for QuantLib::Error'
/opt/quantlib/include/ql/date.hpp:503: undefined reference to
`QuantLib::Date::Date[in-charge]()'
/opt/quantlib/include/ql/instrument.hpp:132: undefined reference to
`QuantLib::Date::Date[in-charge]()'
/usr/include/g++/bits/sstream.tcc:141: undefined reference to
`QuantLib::Error::Error[in-charge](std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&, long,
std::basic_string<char, std::char_traits<char>, std::allocator<char> >
const&, std::basic_string<char, std::char_traits<char>, std::allocator<char>
> const&)'
/opt/quantlib/include/ql/instrument.hpp:140: undefined reference to `typeinfo
for QuantLib::Error'
/usr/include/g++/bits/sstream.tcc:141: undefined reference to
`QuantLib::Error::Error[in-charge](std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&, long,
std::basic_string<char, std::char_traits<char>, std::allocator<char> >
const&, std::basic_string<char, std::char_traits<char>, std::allocator<char>
> const&)'
/opt/quantlib/include/ql/instrument.hpp:140: undefined reference to `typeinfo
for QuantLib::Error'
/opt/quantlib/include/ql/CashFlows/floatingratecoupon.hpp:92: undefined
reference to `QuantLib::Calendar::advance(QuantLib::Date const&, int,
QuantLib::TimeUnit, QuantLib::BusinessDayConvention) const'
/opt/quantlib/include/ql/TermStructures/flatforward.hpp:132: undefined
reference to `QuantLib::Calendar::advance(QuantLib::Date const&, int,
QuantLib::TimeUnit, QuantLib::BusinessDayConvention) const'
/usr/include/g++/bits/sstream.tcc:109: undefined reference to
`QuantLib::Error::Error[in-charge](std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&, long,
std::basic_string<char, std::char_traits<char>, std::allocator<char> >
const&, std::basic_string<char, std::char_traits<char>, std::allocator<char>
> const&)'
/opt/quantlib/include/ql/PricingEngines/Vanilla/mceuropeanengine.hpp:274:
undefined reference to `typeinfo for QuantLib::Error'
/usr/include/g++/bits/sstream.tcc:211: undefined reference to
`QuantLib::Error::Error[in-charge](std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&, long,
std::basic_string<char, std::char_traits<char>, std::allocator<char> >
const&, std::basic_string<char, std::char_traits<char>, std::allocator<char>
> const&)'
/opt/quantlib/include/ql/voltermstructure.hpp:337: undefined reference to
`typeinfo for QuantLib::Error'
/usr/include/g++/bits/sstream.tcc:211: undefined reference to
`QuantLib::Error::Error[in-charge](std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&, long,
std::basic_string<char, std::char_traits<char>, std::allocator<char> >
const&, std::basic_string<char, std::char_traits<char>, std::allocator<char>
> const&)'
/opt/quantlib/include/ql/voltermstructure.hpp:337: undefined reference to
`typeinfo for QuantLib::Error'
/usr/include/g++/bits/sstream.tcc:108: undefined reference to
`QuantLib::Error::Error[in-charge](std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&, long,
std::basic_string<char, std::char_traits<char>, std::allocator<char> >
const&, std::basic_string<char, std::char_traits<char>, std::allocator<char>
> const&)'
/opt/quantlib/include/ql/voltermstructure.hpp:337: undefined reference to
`typeinfo for QuantLib::Error'
/usr/include/g++/bits/stl_algo.h:270: undefined reference to
`QuantLib::Error::Error[in-charge](std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&, long,
std::basic_string<char, std::char_traits<char>, std::allocator<char> >
const&, std::basic_string<char, std::char_traits<char>, std::allocator<char>
> const&)'
/opt/quantlib/include/ql/Optimization/leastsquare.hpp:167: undefined reference
to `typeinfo for QuantLib::Error'
/opt/quantlib/include/ql/TermStructures/quantotermstructure.hpp:121: undefined
reference to `QuantLib::Error::Error[in-charge](std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&, long,
std::basic_string<char, std::char_traits<char>, std::allocator<char> >
const&, std::basic_string<char, std::char_traits<char>, std::allocator<char>
> const&)'
/opt/quantlib/include/ql/FiniteDifferences/shoutcondition.hpp:80: undefined
reference to `typeinfo for QuantLib::Error'
/usr/include/g++/bits/sstream.tcc:104: undefined reference to
`QuantLib::Error::Error[in-charge](std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&, long,
std::basic_string<char, std::char_traits<char>, std::allocator<char> >
const&, std::basic_string<char, std::char_traits<char>, std::allocator<char>
> const&)'
/usr/include/g++/bits/vector.tcc:257: undefined reference to `typeinfo for
QuantLib::Error'
/usr/include/g++/bits/sstream.tcc:107: undefined reference to
`QuantLib::Error::Error[in-charge](std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&, long,
std::basic_string<char, std::char_traits<char>, std::allocator<char> >
const&, std::basic_string<char, std::char_traits<char>, std::allocator<char>
> const&)'
/opt/quantlib/include/ql/PricingEngines/Vanilla/mceuropeanengine.hpp:272:
undefined reference to `typeinfo for QuantLib::Error'
/opt/quantlib/include/ql/TermStructures/forwardstructure.hpp:88: undefined
reference to `QuantLib::Date::Date[in-charge]()'
/opt/quantlib/include/ql/CashFlows/fixedratecoupon.hpp:76: undefined reference
to `QuantLib::Date::Date[in-charge]()'
/opt/quantlib/include/ql/Optimization/leastsquare.hpp:166: undefined reference
to `QuantLib::BlackVolTermStructure::blackForwardVariance(double, double,
double, bool) const'
/opt/quantlib/include/ql/voltermstructure.hpp:379: undefined reference to
`QuantLib::Date::Date[in-charge]()'
/opt/quantlib/include/ql/cashflow.hpp:62: undefined reference to
`QuantLib::Date::Date[in-charge]()'
/opt/quantlib/include/ql/termstructure.hpp:128: undefined reference to
`QuantLib::Date::maxDate()'
/opt/quantlib/include/ql/termstructure.hpp:128: undefined reference to
`QuantLib::Date::maxDate()'
/usr/include/g++/bits/stl_tree.h:1236: undefined reference to
`QuantLib::InterestRate::InterestRate[in-charge](double, QuantLib::DayCounter
const&, QuantLib::Compounding, QuantLib::Frequency)'
/usr/include/g++/bits/stl_algo.h:262: undefined reference to
`QuantLib::Error::Error[in-charge](std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&, long,
std::basic_string<char, std::char_traits<char>, std::allocator<char> >
const&, std::basic_string<char, std::char_traits<char>, std::allocator<char>
> const&)'
/usr/include/g++/iostream:79: undefined reference to `typeinfo for
QuantLib::Error'
/opt/quantlib/include/ql/termstructure.hpp:128: undefined reference to
`QuantLib::Date::maxDate()'
/opt/quantlib/include/ql/voltermstructure.hpp:382: undefined reference to
`QuantLib::Date::Date[in-charge]()'
testquant.o(.gnu.linkonce.t._ZNK8QuantLib24SwaptionVolatilityMatrix12convertDatesERKNS_4DateERKNS_6PeriodE+0x68):/opt/quantlib/include/ql/voltermstructure.hpp:312:
undefined reference to `QuantLib::Date::Date[in-charge]()'
/opt/quantlib/include/ql/Math/array.hpp:176: undefined reference to
`boost::assertion_failed(char const*, char const*, char const*, long)'
/opt/quantlib/include/ql/Math/array.hpp:176: undefined reference to
`boost::assertion_failed(char const*, char const*, char const*, long)'
/opt/quantlib/include/ql/Math/array.hpp:176: undefined reference to
`boost::assertion_failed(char const*, char const*, char const*, long)'
/opt/quantlib/include/ql/Math/array.hpp:176: undefined reference to
`boost::assertion_failed(char const*, char const*, char const*, long)'
/opt/quantlib/include/ql/Math/array.hpp:176: undefined reference to
`boost::assertion_failed(char const*, char const*, char const*, long)'
testquant.o(.gnu.linkonce.t._ZNK5boost10shared_ptrIN8QuantLib18BlackVarianceCurveEEptEv+0x23):/opt/quantlib/include/ql/Math/array.hpp:176:
more undefined references to `boost::assertion_failed(char const*, char
const*, char const*, long)' follow
/opt/quantlib/include/ql/Patterns/lazyobject.hpp:105: undefined reference to
`vtable for QuantLib::Error'
/opt/quantlib/include/ql/discretizedasset.hpp:236: undefined reference to
`QuantLib::Date::advance(QuantLib::Date const&, int, QuantLib::TimeUnit)'
/usr/include/g++/bits/sstream.tcc:197: undefined reference to
`QuantLib::Error::Error[in-charge](std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&, long,
std::basic_string<char, std::char_traits<char>, std::allocator<char> >
const&, std::basic_string<char, std::char_traits<char>, std::allocator<char>
> const&)'
/usr/include/g++/bits/vector.tcc:256: undefined reference to `typeinfo for
QuantLib::Error'
/opt/quantlib/include/ql/Math/array.hpp:176: undefined reference to
`boost::assertion_failed(char const*, char const*, char const*, long)'
/opt/quantlib/include/ql/Math/array.hpp:320: undefined reference to
`QuantLib::Date::Date[in-charge]()'
/opt/quantlib/include/ql/termstructure.hpp:116: undefined reference to
`QuantLib::Date::todaysDate()'
/home/bryan/Documents/computer/c++/programs/tasks/testquant/src/testquant.cpp:30:
undefined reference to `QuantLib::Date::Date[in-charge]()'
/opt/quantlib/include/ql/Math/array.hpp:176: undefined reference to
`QuantLib::Date::Date[in-charge]()'
/usr/include/g++/bits/sstream.tcc:222: undefined reference to
`QuantLib::Error::Error[in-charge](std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&, long,
std::basic_string<char, std::char_traits<char>, std::allocator<char> >
const&, std::basic_string<char, std::char_traits<char>, std::allocator<char>
> const&)'
/opt/quantlib/include/ql/Math/matrix.hpp:504: undefined reference to `typeinfo
for QuantLib::Error'
/opt/quantlib/include/ql/Volatilities/capflatvolvector.hpp:121: undefined
reference to `QuantLib::Error::Error[in-charge](std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&, long,
std::basic_string<char, std::char_traits<char>, std::allocator<char> >
const&, std::basic_string<char, std::char_traits<char>, std::allocator<char>
> const&)'
/usr/include/g++/iostream:106: undefined reference to `typeinfo for
QuantLib::Error'
/opt/quantlib/include/ql/Volatilities/capflatvolvector.hpp:121: undefined
reference to `QuantLib::Error::Error[in-charge](std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&, long,
std::basic_string<char, std::char_traits<char>, std::allocator<char> >
const&, std::basic_string<char, std::char_traits<char>, std::allocator<char>
> const&)'
/usr/include/g++/iostream:106: undefined reference to `typeinfo for
QuantLib::Error'
/opt/quantlib/include/ql/Math/array.hpp:176: undefined reference to
`boost::assertion_failed(char const*, char const*, char const*, long)'
/opt/quantlib/include/ql/Volatilities/impliedvoltermstructure.hpp:109:
undefined reference to `QuantLib::Error::Error[in-charge]
(std::basic_string<char, std::char_traits<char>, std::allocator<char> >
const&, long, std::basic_string<char, std::char_traits<char>,
std::allocator<char> > const&, std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&)'
/opt/quantlib/include/ql/Optimization/leastsquare.hpp:182: undefined reference
to `typeinfo for QuantLib::Error'
/usr/include/g++/bits/sstream.tcc:104: undefined reference to
`QuantLib::Error::Error[in-charge](std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&, long,
std::basic_string<char, std::char_traits<char>, std::allocator<char> >
const&, std::basic_string<char, std::char_traits<char>, std::allocator<char>
> const&)'
/opt/quantlib/include/ql/daycounter.hpp:114: undefined reference to `typeinfo
for QuantLib::Error'
/opt/quantlib/include/ql/FiniteDifferences/americancondition.hpp:68: undefined
reference to `QuantLib::Error::Error[in-charge](std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&, long,
std::basic_string<char, std::char_traits<char>, std::allocator<char> >
const&, std::basic_string<char, std::char_traits<char>, std::allocator<char>
> const&)'
/opt/quantlib/include/ql/FiniteDifferences/shoutcondition.hpp:84: undefined
reference to `typeinfo for QuantLib::Error'
/opt/quantlib/include/ql/instrument.hpp:149: undefined reference to
`QuantLib::Error::Error[in-charge](std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&, long,
std::basic_string<char, std::char_traits<char>, std::allocator<char> >
const&, std::basic_string<char, std::char_traits<char>, std::allocator<char>
> const&)'
testquant.o(.gnu.linkonce.t._ZNK8QuantLib21BlackVolTermStructure10checkRangeEddb+0x7ea):/opt/quantlib/include/ql/instrument.hpp:149:
undefined reference to `typeinfo for QuantLib::Error'
/opt/quantlib/include/ql/instrument.hpp:127: undefined reference to
`QuantLib::InterestRate::compoundFactor(double) const'
/opt/quantlib/include/ql/CashFlows/coupon.hpp:120: undefined reference to
`QuantLib::InterestRate::impliedRate(double, double, QuantLib::DayCounter
const&, QuantLib::Compounding, QuantLib::Frequency)'
/usr/include/g++/bits/sstream.tcc:149: undefined reference to
`QuantLib::Error::Error[in-charge](std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&, long,
std::basic_string<char, std::char_traits<char>, std::allocator<char> >
const&, std::basic_string<char, std::char_traits<char>, std::allocator<char>
> const&)'
/opt/quantlib/include/ql/voltermstructure.hpp:337: undefined reference to
`typeinfo for QuantLib::Error'
/opt/quantlib/include/ql/FiniteDifferences/shoutcondition.hpp:80: undefined
reference to `QuantLib::InterestRate::impliedRate(double, double,
QuantLib::DayCounter const&, QuantLib::Compounding, QuantLib::Frequency)'
/opt/quantlib/include/ql/Math/array.hpp:176: undefined reference to
`boost::assertion_failed(char const*, char const*, char const*, long)'
/opt/quantlib/include/ql/Math/array.hpp:176: undefined reference to
`boost::assertion_failed(char const*, char const*, char const*, long)'
/opt/quantlib/include/ql/Math/array.hpp:176: undefined reference to
`boost::assertion_failed(char const*, char const*, char const*, long)'
/opt/quantlib/include/ql/Math/array.hpp:176: undefined reference to
`boost::assertion_failed(char const*, char const*, char const*, long)'
/opt/quantlib/include/ql/Math/array.hpp:176: undefined reference to
`boost::assertion_failed(char const*, char const*, char const*, long)'
testquant.o(.gnu.linkonce.t._ZNK5boost10shared_ptrIN8QuantLib19Interpolation2DImplEEptEv+0x23):/opt/quantlib/include/ql/Math/array.hpp:176:
more undefined references to `boost::assertion_failed(char const*, char
const*, char const*, long)' follow
/opt/quantlib/include/ql/option.hpp:42: undefined reference to
`QuantLib::Error::Error[in-charge](std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&, long,
std::basic_string<char, std::char_traits<char>, std::allocator<char> >
const&, std::basic_string<char, std::char_traits<char>, std::allocator<char>
> const&)'
/opt/quantlib/include/ql/PricingEngines/Vanilla/mceuropeanengine.hpp:270:
undefined reference to `typeinfo for QuantLib::Error'
/opt/quantlib/include/ql/Math/array.hpp:320: undefined reference to
`QuantLib::Date::Date[in-charge]()'
/usr/include/g++/bits/sstream.tcc:140: undefined reference to
`QuantLib::Error::Error[in-charge](std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&, long,
std::basic_string<char, std::char_traits<char>, std::allocator<char> >
const&, std::basic_string<char, std::char_traits<char>, std::allocator<char>
> const&)'
/usr/include/g++/bits/vector.tcc:257: undefined reference to `typeinfo for
QuantLib::Error'
/opt/quantlib/include/ql/FiniteDifferences/americancondition.hpp:68: undefined
reference to `QuantLib::Error::Error[in-charge](std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&, long,
std::basic_string<char, std::char_traits<char>, std::allocator<char> >
const&, std::basic_string<char, std::char_traits<char>, std::allocator<char>
> const&)'
/opt/quantlib/include/ql/FiniteDifferences/shoutcondition.hpp:84: undefined
reference to `typeinfo for QuantLib::Error'
/opt/quantlib/include/ql/Math/array.hpp:176: undefined reference to
`boost::assertion_failed(char const*, char const*, char const*, long)'
/usr/include/g++/bits/sstream.tcc:162: undefined reference to
`QuantLib::Error::Error[in-charge](std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&, long,
std::basic_string<char, std::char_traits<char>, std::allocator<char> >
const&, std::basic_string<char, std::char_traits<char>, std::allocator<char>
> const&)'
/opt/quantlib/include/ql/Instruments/payoffs.hpp:144: undefined reference to
`typeinfo for QuantLib::Error'
/opt/quantlib/include/ql/FiniteDifferences/americancondition.hpp:61: undefined
reference to `QuantLib::Error::Error[in-charge](std::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&, long,
std::basic_string<char, std::char_traits<char>, std::allocator<char> >
const&, std::basic_string<char, std::char_traits<char>, std::allocator<char>
> const&)'
/opt/quantlib/include/ql/Math/array.hpp:451: undefined reference to `typeinfo
for QuantLib::Error'
*** Exited with status: 2 ***


--
bryan


Reply | Threaded
Open this post in threaded view
|

Re: problems linking to quantlib

eric ehlers
Hi Bryan

You need to use the -l option to tell gcc to link to the QuantLib library.

If the directory containing the QuantLib library is not among the
standard list of directories searched by gcc then you need to use the
-L option to specify the path.

I don't know Kdevelop but at the command line the command might look like

/usr/bin/g++ -o testquant testquant.o -L/opt/quantlib/lib -lQuantLib

(assuming QuantLib is installed as /opt/quantlib/lib/libQuantLib.so)

Finally having compiled your executable you need to ensure that your
loader knows where to find the QuantLib library.  If the path
containing the QuantLib library is not among those searched by your
loader then you need to specify it e.g.

export LD_LIBRARY_PATH=/opt/quantlib/lib

Regards,
Eric

On 7/24/05, bryan kelly <[hidden email]> wrote:

> Thank you in advance for help on this item.  I have tried googling a number of
> times, but I can't find any information on point from google or the mailing
> lists.
>
> I am running SUSE 9.2 linux with g++ 3.3.3 and kdevelop 3.2.1 on KDE 3.4.1.  I
> compiled and  installed quantlib without error in the /opt directory, and I
> am now trying to ensure that my programs compile and link to quantlib.  I
> have been attempting to complie the following simple program, without success
> (when I remove references to QuantLib, the program compiles just fine)....
> ------------------------------------------------------------------------------------------------------------
> // the only header you need to use QuantLib
> #include <ql/quantlib.hpp>
> #include <iostream>
> #include <iomanip>
>
> using namespace QuantLib;
>
> int main(int argc, char *argv[])
> {
>   return EXIT_SUCCESS;
> }
> ------------------------------------------------------------------------------------------------------------
>
> I get quite a number of complier errors (below), and I can't quite figure out
> what is causing this.  All of these errors come up during the linking process.
> Does anyone have any ideas?
>
> There seem to be a fair number of errors associated with undefined references;
> however, the line numbers mentioned don't even match up with the items in
> question.
>
> (for instance, the first error below references, date.hpp line 503 does not
> contain any reference at all to blackVarianceImpl(double, double) const, yet
> an error is returned by the compiler)
> --------------------------------------------------------------------------------------------------------------
> testquant.o(.gnu.linkonce.r._ZTVN8QuantLib20BlackVarianceSurfaceE+0x38):/opt/quantlib/include/ql/date.hpp:503:
> undefined reference to
> `QuantLib::BlackVarianceSurface::blackVarianceImpl(double, double) const'

<snip>

> *** Exited with status: 2 ***
>
>
> --
> bryan
>
>
> -------------------------------------------------------
> SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
> from IBM. Find simple to follow Roadmaps, straightforward articles,
> informative Webcasts and more! Get everything you need to get up to
> speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
> _______________________________________________
> Quantlib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>