Compile Error with gcc v4.4.1 and Qt 4.6.0

This forum is for all bugs and errors concerning the current SVN snapshot.
Note that all bugs concerning the final releases should be posted on the KeePassX project page
roland-telekom
KPX user
Posts: 2
Joined: 11 Dec 2009, 13:22

Compile Error with gcc v4.4.1 and Qt 4.6.0

Postby roland-telekom » 11 Dec 2009, 13:35

I try to build SVN rev. 348 with gcc 4.4.1 and Qt 4.6.0 and get the following error:

Code: Select all

g++ -c -include ../build/keepassx -pipe -O2 -march=i686 -pipe -Wall -W -Wno-sign-compare -D_REENTRANT -DAUTOTYPE -DGLOBAL_AUTOTYPE -DQT_NO_DEBUG -DQT_XML_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4/QtXml -I/usr/include/qt4 -I. -Ilib -Icrypto -Iplugins/interfaces -Iexport -Iimport -Idialogs -I../build/ui -I../build/moc -o ../build/moc_Kdb3Database.o ../build/moc/moc_Kdb3Database.cpp
../build/moc/moc_Kdb3Database.cpp: In member function 'virtual const QMetaObject* Kdb3Database::metaObject() const':
../build/moc/moc_Kdb3Database.cpp:51: error: 'QObject' is an ambiguous base of 'Kdb3Database'
../build/moc/moc_Kdb3Database.cpp:51: error: 'QObject' is an ambiguous base of 'Kdb3Database'
make[1]: *** [../build/moc_Kdb3Database.o] Error 1
make[1]: Leaving directory `/usr/local/src/keepassx-trunk/trunk/src'
make: *** [sub-src-make_default] Error 2


I think it has something to do with the fact that the class Kdb3Database uses multiple inheritance. It is inherited from IDatabase and ICustomIcons, which in turn are both inherited from QObject. The compiler gets confused because it doesn't know which of the two QObject's attributes it is supposed to use for Kdb3Database. A workaround would be to use containment and not inheritance for one of the two interfaces. Maybe there is a simpler solution - obviously the same code did work before ...

UPDATE:
Qt documentation is very specific about multiple inheritance and QObject:
http://doc.trolltech.com/4.6/moc.html#multiple-inheritance-requires-qobject-to-be-first
"... be sure that only the first inherited class is a QObject ..."

So probably only earlier gcc versions (<= 4.3.x) did not complain about this bug.

roland-telekom
KPX user
Posts: 2
Joined: 11 Dec 2009, 13:22

Re: Compile Error with gcc v4.4.1 and Qt 4.6.0

Postby roland-telekom » 15 Dec 2009, 18:36

After some poking around, it seems that the problem really is the new Qt version 4.6.x. It is less forgiving regarding multiple inheritance and QObject.

Switching back to gcc v4.3 or to an older keepassx version do not make any difference. It is always the same compiler error.

debfx
Admin
Posts: 118
Joined: 28 Jan 2008, 22:11

Re: Compile Error with gcc v4.4.1 and Qt 4.6.0

Postby debfx » 24 Dec 2009, 02:43


FrictionLady
KPX user
Posts: 6
Joined: 08 Mar 2011, 23:53

Re: Compile Error with gcc v4.4.1 and Qt 4.6.0

Postby FrictionLady » 10 Mar 2011, 19:49

112 virtual void setImage(const quint32& ImageID)=0;
113 virtual void setTitle(const QString& Title)=0;
114 virtual void setUrl(const QString& URL)=0;
115 virtual void setUsername(const QString& Username)=0;
116 virtual void setPassword(const SecString& Password)=0;
117 virtual void setComment(const QString& Comment)=0;
118 virtual void setBinaryDesc(const QString& BinaryDesc)=0;
119 virtual void setCreation(const KpxDateTime& Creation)=0;
120 virtual void setLastMod(const KpxDateTime& LastMod)=0;
121 virtual void setLastAccess(const KpxDateTime& LastAccess)=0;
122 virtual void setExpire(const KpxDateTime& Expire)=0;
123 virtual void setBinary(const QByteArray& BinaryData)=0;


Everytime I punch in the setBinaryDesc it disappears before I even finish typing the line. I have tried it about forty times in the past three days. Getting really really frustrated. Right now I am going to try and run some data recovery software hoping it can repair my outlook and excel directories. It seems like once I get that figured out I should be ready to roll. I am pretty sure this is the correct method because I just added the skill to my resume which is on file at an IT staffing firm. If I get asked to do it again, I will rock my computing skills the exact same way.


Return to “Bugs (SVN release)”

Who is online

Users browsing this forum: No registered users and 1 guest