This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fwd: c++ linker or compiler problem?


> Hi,
> below you can find my original message to the fsl (the package I am 
> trying to compile) mailgroup about the link/compile problem that I have 
> been experiencing, and the reply I got. Since I don't know c++ I am 
> asking for HELP! Does anybody know how the c++ compiler on 10.1 handles 
> template classes and why it complains about the code below??
>
> THANKS!!
> Zrinka
>
>>
>> I am not sure what compiler you are using on MAC and
>> what is way of this complier to instantiate template
>> classes. The standard way, as far as I know, is to
>> instantiate different versions of template classes in a
>> cpp file, which is the case in the fast library. You
>> can find at the bottom of image.cpp, a bunch of classes
>> are instantiated there, such as
>>         template class ZImage<BYTE>;
>>         template class ZImage<short>;
>>         template class ZImage<float>;
>>
>> It looks to me that the error is that the complier is not
>> happy about the fact those instantiations are actually
>> different classes. I guess you have to find out what this
>> complier expects to do about template classes and modify
>> the instantiation bit.
> --------------------------------------------------------------------------------------------
>>
>> I am still working on compiling fsl on MAC OS 10.1 and I can compile
>> most of the tools (I will post  the details of my changes to this list
>> shortly) but I am having trouble compiling 'fast'. The compilation is
>> actually OK (no errors after I changed the optimisation flag from -03 
>> to
>> -0 -- don't ask why I did this!) but during linking I get the multiple
>> definition error (see below). Since I don;t know c++ this is a little
>> confusing to me. I have posted a similar question to one of the apple
>> development mailing lists and it turns out that the real error message
>> is somewhat different (also a little bit further below) and it was
>> suggeted I used c++filt to reslove this error (I have no idea how to 
>> use
>> c++filt). Well, I understand that you are still not supporting OS X 
>> but I
>> was hoping that this error is not specific to the platform and that you
>> might have seen it (or something similar) before, so that you could
>> give me a hint... Thank you very mich for your help!!!
>>
>> here is the error message that I get:
>> /usr/bin/ld: multiple definitions of symbol ___vt_t6ZImage1ZUc
>> fast.o private external definition of ___vt_t6ZImage1ZUc in section
>> (__DATA,__coalesced)
>> image.o definition of ___vt_t6ZImage1ZUc in section
>> (__DATA,__const)
>> /usr/bin/ld: multiple definitions of symbol ___vt_t6ZImage1Zf
>> fast.o private external definition of ___vt_t6ZImage1Zf in section
>> (__DATA,__coalesced)
>> image.o definition of ___vt_t6ZImage1Zf in section (__DATA,__const)
>> /usr/bin/ld: multiple definitions of symbol
>> ___vt_t6ZImage1Zt4ZRGB1ZUc
>> image.o definition of ___vt_t6ZImage1Zt4ZRGB1ZUc in section
>> (__DATA,__const)
>> /usr/local/fsl/lib/libZImageio.a(fileps.o) private external definition 
>> of
>> ___vt_t6ZImage1Zt4ZRGB1ZUc in section (__DATA,__coalesced)
>> /usr/bin/ld: multiple definitions of symbol ___vt_t6ZImage1Zd
>> image.o definition of ___vt_t6ZImage1Zd in section (__DATA,__const)
>> /usr/local/fsl/lib/libZImageio.a(fileavw.o) private external 
>> definition of
>> ___vt_t6ZImage1Zd in section (__DATA,__coalesced)
>> /usr/bin/ld: multiple definitions of symbol ___vt_t6ZImage1Zi
>> image.o definition of ___vt_t6ZImage1Zi in section (__DATA,__const)
>> /usr/local/fsl/lib/libZImageio.a(fileavw.o) private external 
>> definition of
>> ___vt_t6ZImage1Zi in section (__DATA,__coalesced)
>> /usr/bin/ld: multiple definitions of symbol ___vt_t6ZImage1Zs
>> image.o definition of ___vt_t6ZImage1Zs in section (__DATA,__const)
>> /usr/local/fsl/lib/libZImageio.a(fileavw.o) private external 
>> definition of
>> ___vt_t6ZImage1Zs in section (__DATA,__coalesced)
>> /usr/local/fsl/lib/libZImageio.a(fileavw.o) private external 
>> definition of
>> ___vt_t6ZImage1Zt4ZRGB1ZUc in section (__DATA,__coalesced)
>> /usr/local/fsl/lib/libZImageio.a(filebmp.o) private external 
>> definition of
>> ___vt_t6ZImage1Zt4ZRGB1ZUc in section (__DATA,__coalesced)
>> /usr/local/fsl/lib/libZImageio.a(filepgm.o) private external 
>> definition of
>> ___vt_t6ZImage1Zt4ZRGB1ZUc in section (__DATA,__coalesced)
>> /usr/local/fsl/lib/libZImageio.a(imageiocommon.o) private external
>> definition of ___vt_t6ZImage1Zt4ZRGB1ZUc in section
>> (__DATA,__coalesced)
>> make: *** [fast] Error 1
>> --------------------------
>> here is what I have been told this error really is:
>>
>>
>> /usr/bin/ld: multiple definitions of symbol ZImage<unsigned char>
>> virtual table
>> fast.o private external definition of ZImage<unsigned char> virtual
>> table in section (__DATA,__coalesced)
>> image.o definition of ZImage<unsigned char> virtual table in section
>> (__DATA,__const)
>> /usr/bin/ld: multiple definitions of symbol ZImage<float> virtual table
>>
>>
Zrinka Bilusic
UCLA Brain Mapping
660 Charles Young Drive South
Los Angeles, CA  90095

zrinka@ucla.edu
www.brainmapping.org
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]