Blitz logo

Blitz Support :

From: Max (max_at_[hidden])
Date: 2003-12-05 22:09:46


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