QT: Cannot find moc file

I am trying to create a test application in QT to test another QT application interface using qtlib. I found out that you also need to use the QTEST_MAIN () macro, which expands to a simple main () method that runs all the test functions.

QTEST_MAIN(TestAppUI) #include "testapp.moc" 

I compile it with "make" and somewhere in my CMakeLists.txt. I have

 SET(TEST_APP_SRCS ui/menu/testapp.cpp ) SET(TEST_APP_SRCS_MOC_SRCS ui/menu/testapp.hpp ) QT4_WRAP_CPP(TEST_APP_SRCS ${TEST_APP_SRCS_MOC_SRCS}) 

My problem is that during compilation I get this error.
error: testapp.moc: No such file or directory

I don't know what happened ... Any ideas?

+4
source share
1 answer

I just realized what happened. I needed to add $ {QT_LIBRARIES} $ {QT_QTTEST_LIBRARY} to TARGET_LINK_LIBRARIES ... :) and delete #include "testapp.moc"

+1
source

All Articles