From kde-core-devel Sun Oct 30 16:35:17 2005 From: Christian Ehrlicher Date: Sun, 30 Oct 2005 16:35:17 +0000 To: kde-core-devel Subject: Re: [Patch] fix compile kdecore with msvc Message-Id: <4364F645.8050404 () gmx ! de> X-MARC-Message: https://marc.info/?l=kde-core-devel&m=113069016626334 -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Thiago Macieira schrieb: > Christian Ehrlicher wrote: > >>>Your argument doesn't make sense. Functions that were not overridden >>>will be inherited from QList. >> >>You're wrong. It's true for simple types but not for classes. Try to >>compile this piece of code: >> >>--------------------8<------------------ >>#include >> >>struct testStruct { >> int iFirst; >> int iSecond; > > > bool operator==(const testStruct&) const; > > >>}; >> >>int main(int argc, char *argv[]) >>{ >> QList t1, t2; >> QList s1, s2; >> >> if ( t1 == t2 ) >> qDebug("t1 == t2"); >> if ( s1 == s2 ) >> qDebug("s1 == s2"); >> return 1; >>} >>--------------------8<------------------ >>gcc will fail here (so it's not only the stupid msvc-compiler). > > > By adding the line I showed above, it compiles. Yes, this is clear. > > You cannot compare two structs unless they provide operator==. > > Since KResolverEntry doesn't, you cannot compare two KResolverResults. > You're not supposed to, either, nor transform it into a set or vector. But when you export the class, you have to provide a complete class interface with all functions implemented... > > As for your toSet() test, did you include ? Because that's where > QList::toSet() is defined. I've found a solution for this (see below) > > Anyways, removing the export macro from KResolverResults is out of the > question. If you have a problem compiling, let's work out another > solution. Also I don't know why you won't remove the export macro, here is the solution what you have to change so I can compile kresolver.cpp without any problems. You just have to implement two functions: bool KResolverEntry::operator ==(const KResolverEntry &) const; and inline uint qHash(KResolverEntry key); With this the compiler can generate a complete class (imo including QSet). Christian -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFDZPZFnNKwkgf+zVMRAnK0AKCBo7uxv/KzIOhNoHkIIneb6yMdVwCfZxeo JyEtC+tCtSfVkkwiNB0aOX4= =mMH2 -----END PGP SIGNATURE-----