lballabio / QuantLib

The QuantLib C++ library
http://quantlib.org
Other
5.23k stars 1.78k forks source link

Compiling QuantLib v1.9 results in error: class ‘QuantLib::GaussianWalk’ does not have any field named ‘DistributionRandomWalk’ #176

Closed aloupos closed 7 years ago

aloupos commented 7 years ago

Here's the compiler output:

/bin/sh ../../../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I../../../ql -I../../.. -I../../.. -I/home/aloupos/local/boost_1_62_0 -g -O2 -MT fireflyalgorithm.lo -MD -MP -MF .deps/fireflyalgorithm.Tpo -c -o fireflyalgorithm.lo fireflyalgorithm.cpp libtool: compile: g++ -DHAVE_CONFIG_H -I. -I../../../ql -I../../.. -I../../.. -I/home/aloupos/local/boost_1_62_0 -g -O2 -MT fireflyalgorithm.lo -MD -MP -MF .deps/fireflyalgorithm.Tpo -c fireflyalgorithm.cpp -fPIC -DPIC -o .libs/fireflyalgorithm.o In file included from fireflyalgorithm.cpp:24: ../../../ql/experimental/math/fireflyalgorithm.hpp: In constructor ‘QuantLib::GaussianWalk::GaussianWalk(QuantLib::Real, QuantLib::Real, long unsigned int)’: ../../../ql/experimental/math/fireflyalgorithm.hpp:234: error: class ‘QuantLib::GaussianWalk’ does not have any field named ‘DistributionRandomWalk’ ../../../ql/experimental/math/fireflyalgorithm.hpp:234: error: no matching function for call to ‘QuantLib::DistributionRandomWalk<boost::random::normal_distribution >::DistributionRandomWalk()’ ../../../ql/experimental/math/fireflyalgorithm.hpp:211: note: candidates are: QuantLib::DistributionRandomWalk::DistributionRandomWalk(Distribution, QuantLib::Real, long unsigned int) [with Distribution = boost::random::normal_distribution] ../../../ql/experimental/math/fireflyalgorithm.hpp:208: note: QuantLib::DistributionRandomWalk<boost::random::normal_distribution >::DistributionRandomWalk(const QuantLib::DistributionRandomWalk<boost::random::normal_distribution >&) ../../../ql/experimental/math/fireflyalgorithm.hpp: In constructor ‘QuantLib::LevyFlightWalk::LevyFlightWalk(QuantLib::Real, QuantLib::Real, QuantLib::Real, long unsigned int)’: ../../../ql/experimental/math/fireflyalgorithm.hpp:244: error: class ‘QuantLib::LevyFlightWalk’ does not have any field named ‘DistributionRandomWalk’ ../../../ql/experimental/math/fireflyalgorithm.hpp:244: error: no matching function for call to ‘QuantLib::DistributionRandomWalk::DistributionRandomWalk()’ ../../../ql/experimental/math/fireflyalgorithm.hpp:211: note: candidates are: QuantLib::DistributionRandomWalk::DistributionRandomWalk(Distribution, QuantLib::Real, long unsigned int) [with Distribution = QuantLib::LevyFlightDistribution] ../../../ql/experimental/math/fireflyalgorithm.hpp:208: note: QuantLib::DistributionRandomWalk::DistributionRandomWalk(const QuantLib::DistributionRandomWalk&) make[4]: *** [fireflyalgorithm.lo] Error 1

lballabio commented 7 years ago

Yes, it looks like there's a missing template parameter in the name of the base class in the initialization list. Strange, though. The release was tested with at least 3 or 4 different versions of g++ and clang and none complained. Which one are you using?

aloupos commented 7 years ago

Thanks so much for looking into it!

-bash-4.1$ g++ -v Using built-in specs. Target: x86_64-redhat-linux Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux Thread model: posix gcc version 4.4.7 20120313 (Red Hat 4.4.7-17) (GCC)

lballabio commented 7 years ago

Ok, the oldest version I checked was gcc 4.8. The commit above should have fixed this on the 1.9.x branch. Can you check it out or download it from the green button on https://github.com/lballabio/QuantLib/tree/v1.9.x and test it? (You'll also need to run ./autogen.sh before ./configure)

aloupos commented 7 years ago

Indeed it does! Thanks very much for the speedy fix.

lballabio commented 7 years ago

No problem, thanks for the heads-up.