Hi All, I have a base class called NewtonKrylov, from which a bunch of sub-classes are derived for specific nonlinear formulations. In the base class I have a TimerOutput object to keep track of timing statistics. After recently updating my copy of deal.II, I began to get a linking error having to do with the Timer::get_data() function:
:: lib/geocentric :: 3d :: Remaking lib/Makefile.dep :: lib/geocentric :: 3d :: optimized/MT :: main.cc :: lib/geocentric :: 3d :: optimized/MT :: newton-krylov.cc :: lib/geocentric :: 3d :: optimized/MT :: nk-faulted-geostatic.cc :: lib/geocentric :: 3d :: optimized/MT :: nk-geostatic.cc :: lib/geocentric :: 3d :: optimized/MT :: nk-hydrogeo-2.cc :: lib/geocentric :: 3d :: optimized/MT :: nk-hydrogeo-3.cc :: lib/geocentric :: 3d :: MT :: Linking geocentric lib/3d/newton-krylov.o: In function `dealii::Timer::get_data() const': newton-krylov.cc:(.text+0x0): multiple definition of `dealii::Timer::get_data() const' lib/3d/main.o:main.cc:(.text+0x0): first defined here lib/3d/nk-faulted-geostatic.o: In function `dealii::Timer::get_data() const': nk-faulted-geostatic.cc:(.text+0x0): multiple definition of `dealii::Timer::get_data() const' lib/3d/main.o:main.cc:(.text+0x0): first defined here ... and so on ..... I noticed that get_data() is defined in the header file (timer.h) and I believe it is therefore being included in multiple compilation units (one for each NewtonKrylov subclass), triggering the above multiple definition error. If I move the definition of get_data() to timer.cc this issue goes away. Is there a specific reason that get_data() is defined in the header, rather than the .cc file? My suspicion is that it was originally meant to be inlined, but that this is no longer the case. If anyone has any other insights, either as to changes I should make within my code or to the Timer implementation, I'd appreciate hearing them! Best, Josh _______________________________________________ dealii mailing list http://poisson.dealii.org/mailman/listinfo/dealii
