I successfully compiled and installed QuantLib-0.9.7 and boost-1.38 on a
Fedora 9 machine using g++ 4.3.0, including the examples. Now I'm trying to compile EquityOption.cpp out of the QuantLib source tree, only to figure out how to compile things against QL. (By the way, a line or two in the Docs showing how to compile standalone programs with g++ against QL would be nice.) The automatically generated Makefile in the Examples directory is way too cryptic, so I tried the obvious: g++ -g -Wall -o equityOption -I/usr/local/include/boost-1_38 EquityOption.cpp -lQuantLib and I get countless undefined references. See below. Then I did a google search and I found this answer: http://www.daniweb.com/forums/thread114299.html which has to do with how g++ handles the vtable. So how do I compile and link ExampleOption.cpp (or the like) outside the quantlib src tree? Thanks! /tmp/ccBqI49b.o: In function `~CallableBondVolatilityStructure': /usr/local/include/ql/experimental/callablebonds/ callablebondvolstructure.hpp:63: undefined reference to `vtable for QuantLib::CallableBondVolatilityStructure' /usr/local/include/ql/experimental/callablebonds/ callablebondvolstructure.hpp:63: undefined reference to `vtable for QuantLib::CallableBondVolatilityStructure' /usr/local/include/ql/experimental/callablebonds/ callablebondvolstructure.hpp:63: undefined reference to `vtable for QuantLib::CallableBondVolatilityStructure' /usr/local/include/ql/experimental/callablebonds/ callablebondvolstructure.hpp:63: undefined reference to `VTT for QuantLib::CallableBondVolatilityStructure' /usr/local/include/ql/experimental/callablebonds/ callablebondvolstructure.hpp:63: undefined reference to `vtable for QuantLib::CallableBondVolatilityStructure' /usr/local/include/ql/experimental/callablebonds/ callablebondvolstructure.hpp:63: undefined reference to `vtable for QuantLib::CallableBondVolatilityStructure' /usr/local/include/ql/experimental/callablebonds/ callablebondvolstructure.hpp:63: undefined reference to `vtable for QuantLib::CallableBondVolatilityStructure' /usr/local/include/ql/experimental/callablebonds/ callablebondvolstructure.hpp:63: undefined reference to `VTT for QuantLib::CallableBondVolatilityStructure' /tmp/ccBqI49b.o: In function `~OneFactorCopula': /usr/local/include/ql/experimental/credit/onefactorcopula.hpp:101: undefined reference to `vtable for QuantLib::OneFactorCopula' /usr/local/include/ql/experimental/credit/onefactorcopula.hpp:101: undefined reference to `vtable for QuantLib::OneFactorCopula' /usr/local/include/ql/experimental/credit/onefactorcopula.hpp:101: undefined reference to `vtable for QuantLib::OneFactorCopula' /usr/local/include/ql/experimental/credit/onefactorcopula.hpp:101: undefined reference to `VTT for QuantLib::OneFactorCopula' /usr/local/include/ql/experimental/credit/onefactorcopula.hpp:101: undefined reference to `VTT for QuantLib::OneFactorCopula' /usr/local/include/ql/experimental/credit/onefactorcopula.hpp:101: undefined reference to `vtable for QuantLib::OneFactorCopula' /usr/local/include/ql/experimental/credit/onefactorcopula.hpp:101: undefined reference to `vtable for QuantLib::OneFactorCopula' /usr/local/include/ql/experimental/credit/onefactorcopula.hpp:101: undefined reference to `vtable for QuantLib::OneFactorCopula' /usr/local/include/ql/experimental/credit/onefactorcopula.hpp:101: undefined reference to `VTT for QuantLib::OneFactorCopula' /usr/local/include/ql/experimental/credit/onefactorcopula.hpp:101: undefined reference to `VTT for QuantLib::OneFactorCopula' and on and on and on. ------------------------------------------------------------------------------ _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
On Thu, 2009-03-26 at 02:23 +0000, Amadeus W.M. wrote:
> Now I'm trying to compile EquityOption.cpp out of the QuantLib source > tree, only to figure out how to compile things against QL. (By the way, a > line or two in the Docs showing how to compile standalone programs with > g++ against QL would be nice.) > > The automatically generated Makefile in the Examples directory is way too > cryptic, so I tried the obvious: > > g++ -g -Wall -o equityOption -I/usr/local/include/boost-1_38 > EquityOption.cpp -lQuantLib That should be the way to do it---and in fact, it works here on my Ubuntu box with gcc 4.3.2. I'm using the svn repository, though--I'll check 0.3.7 tomorrow and let you know. Luigi -- Father's got the sack from the water-works For smoking of his old cherry-briar; Father's got the sack from the water-works 'Cos he might set the water-works on fire. ------------------------------------------------------------------------------ _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
On Fri, 27 Mar 2009 17:56:07 +0100, Luigi Ballabio wrote:
> On Thu, 2009-03-26 at 02:23 +0000, Amadeus W.M. wrote: >> Now I'm trying to compile EquityOption.cpp out of the QuantLib source >> tree, only to figure out how to compile things against QL. (By the way, >> a line or two in the Docs showing how to compile standalone programs >> with g++ against QL would be nice.) >> >> The automatically generated Makefile in the Examples directory is way >> too cryptic, so I tried the obvious: >> >> g++ -g -Wall -o equityOption -I/usr/local/include/boost-1_38 >> EquityOption.cpp -lQuantLib > > That should be the way to do it---and in fact, it works here on my > Ubuntu box with gcc 4.3.2. I'm using the svn repository, though--I'll > check 0.3.7 tomorrow and let you know. > > Luigi Thanks for looking into this. Did you really mean 0.3.7? I was trying against 0.9.7. ------------------------------------------------------------------------------ _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
On Mar 27, 2009, at 10:54 PM, Amadeus W.M. wrote: > On Fri, 27 Mar 2009 17:56:07 +0100, Luigi Ballabio wrote: > >> That should be the way to do it---and in fact, it works here on my >> Ubuntu box with gcc 4.3.2. I'm using the svn repository, though-- >> I'll >> check 0.3.7 tomorrow and let you know. >> >> Luigi > > Thanks for looking into this. Did you really mean 0.3.7? I was trying > against 0.9.7. Yes, I meant 0.9.7, of course. I also meant "Monday" when I wrote "tomorrow". At least I got the gcc version right... Luigi ------------------------------------------------------------------------------ _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
On Fri, 27 Mar 2009 23:13:27 +0100, Luigi Ballabio wrote:
> On Mar 27, 2009, at 10:54 PM, Amadeus W.M. wrote: > >> On Fri, 27 Mar 2009 17:56:07 +0100, Luigi Ballabio wrote: >> >>> That should be the way to do it---and in fact, it works here on my >>> Ubuntu box with gcc 4.3.2. I'm using the svn repository, though-- >>> I'll >>> check 0.3.7 tomorrow and let you know. >>> >>> Luigi >> >> Thanks for looking into this. Did you really mean 0.3.7? I was trying >> against 0.9.7. > > Yes, I meant 0.9.7, of course. I also meant "Monday" when I wrote > "tomorrow". At least I got the gcc version right... > > Luigi > > > Compiles if I specify the library directory with -L, like so: g++ -g -Wall -o EquityOption -L/usr/local/lib -I/usr/local/include/ boost-1_38 EquityOption.cpp -lQuantLib Without -L/usr/local/lib it doesn't. This is strange because /sbin/ldconfig -v does pick up /usr/local/lib so the linker should know about it. ldd EquityOption linux-gate.so.1 => (0x00110000) libQuantLib-0.9.7.so => /usr/local/lib/libQuantLib-0.9.7.so (0x00c09000) libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x042f6000) libm.so.6 => /lib/libm.so.6 (0x00111000) libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x058b3000) libc.so.6 => /lib/libc.so.6 (0x0013a000) /lib/ld-linux.so.2 (0x00beb000) so it's linked against QuantLib.so. Don't know why I need to specify -L but at any rate, this is acceptable for now, I'll figure it out later. Thanks for QuantLib! Looking forward to using it. ------------------------------------------------------------------------------ _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Free forum by Nabble | Edit this page |