[Qt-interest] Qt mocks issue multiple definition of

Scott Aron Bloom Scott.Bloom at onshorecs.com
Sun Oct 31 21:12:39 CET 2010


Turn on -Wall I bet it puts out a warning

-----Original Message-----
From: qt-interest-bounces at trolltech.com
[mailto:qt-interest-bounces at trolltech.com] On Behalf Of Pavel Koshevoy
Sent: Sunday, October 31, 2010 1:10 PM
To: qt-interest at trolltech.com
Subject: Re: [Qt-interest] Qt mocks issue multiple definition of

On 10/31/2010 1:46 PM, Alex Ivasyuv wrote:
> Hi,
>
> I found an ?issue? with Qt mocks.
> Please checkout this simple code
> http://qttestissue.googlecode.com/svn/trunk/
>
> If you have the same classes names, Qt mocks create the same object
> names for them, and as result fails with the following error:
"multiple
> definition of"

Actually, your classes are named differently
A/MyClass.* implements MyClass2
B/MyClass.* implements MyClass

The class name does not have to match the file name (as in your case 
with MyClass2), but it is a good practice that a file name matches the 
name of the class -- rename A/MyClass.* to A/MyClass2.*

Other than that, this seems to be a qmake bug, it generated a Makefile 
that links the same object file twice.

     Pavel.

_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest




More information about the Qt-interest-old mailing list