win32 build stops with linker error

David Faure faure at kde.org
Wed Feb 8 11:58:23 CET 2006


On Tuesday 07 February 2006 23:05, Peter Kümmel wrote:
> David Faure wrote:
> > On Tuesday 07 February 2006 20:29, Christian Ehrlicher wrote:
> >>> kio.lib(kio.dll) : error LNK2005: "public: class QString & __thiscall QMap<class QString,class QString>::operator[](class QSt
> >>> ring const &)" (??A?$QMap at VQString@@V1@@@QAEAAVQString@@ABV1@@Z) already defined in khtml_printsettings.obj
> >>> kio.lib(kio.dll) : error LNK2005: "public: __thiscall QMap<class QString,class QString>::~QMap<class QString,class QString>(v
> >>> oid)" (??1?$QMap at VQString@@V1@@@QAE at XZ) already defined in khtml_settings.obj
> > 
> > Buuh :(
> > 
> > IIRC you need "template class QMap<QString,QString>;" in global.cpp
> > to force a template instantiation there, so that dependent libs don't do it themselves.
> 
> I've tested it, but this doesn't help, like the error message indicates:
> there is already a instantiation in kio.

I just saw something similar in another project here.
It seems that the explicit instantiation should be in the .h, not in the .cpp,
and with dlllimport.
Hmm, that's what you tried first, but try with s/extern template/template class/ ?

Please don't change the base class, we would have to redefine the whole QMap API...

-- 
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).



More information about the Kde-buildsystem mailing list