![]() |
Blitz Support : |
From: Julian C. Cummings (cummings_at_[hidden])
Date: 2003-12-08 14:37:06
Max,
This is indeed a bug, and I am checking in a fix for it now. The problem is
that the initializations of ZeroElement::zero_ in blitz/zero.cc are being
included by blitz/zero.h, which can be included by multiple source files.
My solution is to include blitz/zero.cc only from src/globals.cpp, so that
we get just one copy of these items in libblitz.a. I also spotted and fixed
a typo in the specialization of ZeroElement for complex types. The accessor
function should be named "zero" rather than "getZero", to match with the
general templated version of ZeroElement in blitz/zero.h. Thanks for noting
the problem.
Regards, Julian C.
Dr. Julian C. Cummings
Staff Scientist, CACR/Caltech
(626) 395-2543
cummings_at_[hidden]
> -----Original Message-----
> From: blitz-support-bounces_at_[hidden]
> [mailto:blitz-support-bounces_at_[hidden]] On Behalf Of Max
> Sent: Friday, December 05, 2003 7:10 PM
> To: blitz-support_at_[hidden]
> Subject: [Blitz-support] Multiple defined symbol error?
>
>
> Hiya, I'm trying to compile code with Blitz++.
>
> So far I pretty much have main in one file and a function in
> the other.
> They both include a header file which, at the meat of it
> declares this.
>
> blitz::Vector< blitz::Matrix<double> > loadImage(char *path);
>
> imio.cpp defines this function.
> main.cpp uses it.
>
> They both compile perfectly fine without errors. When I try
> to link them:
> g++ -o frac main.o imio.o -lblitz -lMagick++
> collect: recompiling main.cpp
> collect: relinking
> collect: recompiling main.cpp
> collect: relinking
> imio.o(.bss+0x4): multiple definition of
> `blitz::ZeroElement<std::complex<float> >::zero_'
> main.o(.bss+0x4): first defined here
> imio.o(.bss+0xc): multiple definition of
> `blitz::ZeroElement<std::complex<double> >::zero_'
> main.o(.bss+0xc): first defined here
> imio.o(.bss+0x1c): multiple definition of
> `blitz::ZeroElement<std::complex<long double> >::zero_'
> main.o(.bss+0x1c): first defined here
> collect2: ld returned 1 exit status
>
>
> For some reason that zero constance is getting multiply defined? Is
> this a bug in the compiler not removing templated constants?
>
> I'm not very experienced with using templates beyond basic STL in
> programs, so this completely baffles me.
>
> Max
>
> _______________________________________________
> Blitz-support mailing list
> Blitz-support_at_[hidden]
> http://www.oonumerics.org/mailman/listinfo.cgi> /blitz-support
>