hashDefine
hashDefine

Reputation: 1491

Qt test-unit: Error: undefined reference to `imp__ZN5Q

I am trying to create a "Qt unit test" following this tutorial. I created a new project: Qt Gui Application with a header file as mentioned and a class that contains the test function. I added #CONFIG += testlib to my ".pro" file. However, when I run my code, I get this errors:

In function `simulateEvent':

then in function 'mouseEvent':

then in function 'simulateEvent' again:

then in function 'mouseEvent' again:

I could not find any explanation for this as everything looks right . what am I missing ?

Upvotes: 1

Views: 2429

Answers (3)

Joacoking
Joacoking

Reputation: 1

I had the same problem. In my case: I used "delete" on an instance of a class what was inherited from QWidget. I had to change the inheritance for my class from QWidget to QObject.

Upvotes: 0

Computer User
Computer User

Reputation: 1

Try Qt += declarative, testlib didn't work for me, but declarative did.

Upvotes: 0

Sergey Shambir
Sergey Shambir

Reputation: 1602

Try QT += testlib, without starting #

Upvotes: 3

Related Questions