[Insight-users] compiling ITK with gcc 3.2?

Harri Tapio Jaalinoja harri.jaalinoja@helsinki.fi
Wed, 16 Oct 2002 11:43:44 +0300 (EET DST)


Hi,

with the vnl_matrix+double-.cxx looking like this...

-- clip --
template class vnl_matrix<double >;
template vnl_matrix<double > operator-(double const &, vnl_matrix<double > const &);
VCL_INSTANTIATE_INLINE(vnl_matrix<double > operator+(double const &, vnl_matrix<double > const &));
VCL_INSTANTIATE_INLINE(vnl_matrix<double > operator*(double const &, vnl_matrix<double > const &));
template double dot_product(vnl_matrix<double > const &, vnl_matrix<double > const &);
template double inner_product(vnl_matrix<double > const &, vnl_matrix<double > const &);
template double cos_angle(vnl_matrix<double > const &, vnl_matrix<double > const &);
template vnl_matrix<double > element_product(vnl_matrix<double > const &, vnl_matrix<double > const &);
template vnl_matrix<double > element_quotient(vnl_matrix<double > const &, vnl_matrix<double > const &);
template int vnl_inplace_transpose(double*, unsigned, unsigned, char*, unsigned);
template vcl_ostream & operator<<(vcl_ostream &, vnl_matrix<double > const &);
template vcl_istream & operator>>(vcl_istream &, vnl_matrix<double >       &);
VCL_INSTANTIATE_INLINE(bool operator!=(vnl_matrix<double > const &, vnl_matrix<double > const &))
-- clip --

... the error comes from the last line.

I can get over this by using the trick pointed out by Koen, setting
#define VCL_NEEDS_INLINE_INSTANTIATION 0
in Build/Code/Numerics/vxl/vcl/vcl_config_compiler.h

However, now I encounter this error:

itkNumericsHeaderTest.o: In function
`__static_initialization_and_destruction_0(int, int)':
itkNumericsHeaderTest.o(.text+0x36): undefined reference to
`std::ios_base::Init::Init[in-charge]()'
itkNumericsHeaderTest.o: In function `__tcf_0':
itkNumericsHeaderTest.o(.text+0x65): undefined reference to
`std::ios_base::Init::~Init [in-charge]()'
itkNumericsHeaderTest.o(.eh_frame+0x11): undefined reference to
`__gxx_personality_v0'
collect2: ld returned 1 exit status
make[7]: ***
[/home/hajaalin/Insight_CVS/Insight/Build/bin/itkNumericsHeaderTest] Error
1
make[6]: *** [default_target] Error 2
make[5]: *** [default_target_Numerics] Error 2
make[4]: *** [default_target] Error 2
make[3]: *** [default_target_Code] Error 2
make[2]: *** [default_target] Error 2
make[1]: *** [default_target_Testing] Error 2
make: *** [default_target] Error 2


Making good progress, but not quite there yet :)

Thanks,
Harri


On Tue, 15 Oct 2002, Luis Ibanez wrote:

>
> Hi Harri,
>
> Given that the compiler error is produced in the
> expansion of a macro it is hard to figure out
> where the error is comming from.
>
> Could you please try the following,
>
> Temporarily replace the line
>
>       VNL_MATRIX_INSTANTIATE(double)
>
>     in vnl_matrix+double-.cxx
>
> with the actual content of the Macro as defined in
>
>     Insight/Code/Numerics/vxl/vnl/vnl_matrix.txx:
>
> It should look something like:
>
> template class vnl_matrix<T >;
> template vnl_matrix<T > operator-(T const &, vnl_matrix<T > const &);
> VCL_INSTANTIATE_INLINE(vnl_matrix<T > operator+(T const &, vnl_matrix<T
>  > const &));
> VCL_INSTANTIATE_INLINE(vnl_matrix<T > operator*(T const &, vnl_matrix<T
>  > const &));
> template T dot_product(vnl_matrix<T > const &, vnl_matrix<T > const &);
> template T inner_product(vnl_matrix<T > const &, vnl_matrix<T > const &);
> template T cos_angle(vnl_matrix<T > const &, vnl_matrix<T > const &);
> template vnl_matrix<T > element_product(vnl_matrix<T > const &,
> vnl_matrix<T > const &);
> template vnl_matrix<T > element_quotient(vnl_matrix<T > const &,
> vnl_matrix<T > const &);
> template int vnl_inplace_transpose(T*, unsigned, unsigned, char*,
> unsigned);
> template vcl_ostream & operator<<(vcl_ostream &, vnl_matrix<T > const &);
> template vcl_istream & operator>>(vcl_istream &, vnl_matrix<T >       &);
> VCL_INSTANTIATE_INLINE(bool operator!=(vnl_matrix<T > const &,
> vnl_matrix<T > const &))
>
>
>
> Note that the "\" should be removed so each line is passed
> independently to the compiler.
>
> This should help us to identify the offending line.
>
>
> Thanks
>
>     Luis
>
> =========================================
>
> Harri Tapio Jaalinoja wrote:
> > Hi Mathieu (and others),
> >
> > sorry to say it still does not work, I get the same error (non-template
> > used as template)
> >
> > I also tried adding '#include <cstdio>' in
> > Code/Numerics/vxl/vnl/vnl_matrix.txx, where the definition
> > #define VNL_MATRIX_INSTANTIATE(T) \
> > is, but that did not help either (this was just guesswork).
> >
> > [hajaalin@gene Build]$ echo $CC; echo $CXX
> > /usr/bin/gcc
> > /usr/bin/gcc
> > [hajaalin@gene Build]$ gcc --version
> > gcc (GCC) 3.2 (Mandrake Linux 9.0 3.2-2mdk)
> >
> > Thanks,
> >
> > Harri
> >
> >
> > On Tue, 15 Oct 2002, Mathieu Malaterre wrote:
> >
> >
> >>Hi Harri (again),
> >>  Could you try adding:
> >>#include <cstdio>
> >>in
> >>Insight/Code/Numerics/vxl/vnl/Templates/vnl_matrix+double-.cxx
> >>
> >>or else try adding -Wno-deprecated in CMAKE_CXX_FLAGS (in your
> >>CMakeCache.txt file).
> >>
> >>and tell me if it works ?
> >>
> >>thanks
> >>
> >>ref:
> >>http://www.geocrawler.com/archives/3/216/2001/4/150/5671325/
> >>
> >>mathieu
> >>
>
>
>
>