A multiple definition error in Creating library file: liboctave.dll.a (gcc-4.3.2-dw2-TDM for mingw )
Benjamin Lindner
lindnerben at gmx.net
Sat Feb 14 09:55:10 CST 2009
>>>
>>> Creating library file: liboctave.dll.a
>>> Sparse-C.o:Sparse-C.cc:(.text$_ZN11octave_sortISt7complexIdEE17ascending_compareES1_S1_[octave_sort<std::complex<double>
>>>
>>>> ::ascending_compare(std::complex<double>, std::complex<double>)]+0x0):
>>> multiple definition of `octave_sort<std::complex<double>
>>> >::ascending_compare(std::complex<double>,
>>> std::complex<double>)'
>>> Array-C.o:c:\usr\Tatsu\mingwhome\octaves\octave-3.1.52\liboctave/Array-C.cc:44:
>>>
>>> first defined here
>>>
This double-definition error occurs, because of different
implementations in the coding in Array-C.cc and Sparse-C.cc.
Array-C.cc defines a total template specialization of
octave_sort<Complex>::sort_ascending(const Complex&, const Complex&)
and
octave_sort<Complex>::sort_descending(const Complex&, const Complex&)
whereas Sparse-C.cc provides versions for
operator<(const Complex&, const Complex&)
and
operator>(const Complex&, const Complex&)
which are then used with the instantiated template function
octave_sort<T>::sort_ascending(const T&, const T&)
and
octave_sort<T>::sort_descending(const T&, const T&)
provided in octave-sort.cc.
I'm not sure this why this asymmtery, but changing the code in
Array-C.cc to define operator< and operator> as in Sparse-C.cc removes
the double-definition linker error.
Please consider the attached changeset.
BTW I also see that the code for comparing two Complex values differs in
Sparse-C.cc and Array-C.cc. Is this intentional?
benjamin
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: octave_sort.patch
Url: https://www-old.cae.wisc.edu/pipermail/octave-maintainers/attachments/20090214/00d3d45b/attachment.ksh
More information about the Octave-maintainers
mailing list