Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

QT : Cannot find moc file

I'm trying to create a test application in QT to test another QT application's UI using qtlib. I learned that you also need to use QTEST_MAIN() macro which expands to a simple main() method that runs all the test functions.

QTEST_MAIN(TestAppUI)
#include "testapp.moc"

I'm compiling it using "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, during compilation I'm getting this error.
error: testapp.moc: No such file or directory

I don't know what's wrong... Any ideas?

like image 924
Owen Avatar asked Nov 06 '22 06:11

Owen


1 Answers

I just figured what's wrong. I needed to add ${QT_LIBRARIES} ${QT_QTTEST_LIBRARY} in TARGET_LINK_LIBRARIES ... :) and remove #include "testapp.moc"

like image 56
Owen Avatar answered Nov 09 '22 16:11

Owen