[Qt-interest] Qt mocks issue multiple definition of

Pavel Koshevoy pavel at aragog.com
Sun Oct 31 21:09:42 CET 2010


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.




More information about the Qt-interest-old mailing list