Using Qt inside Clion

若如初见. 提交于 2019-12-02 21:00:48

Your CMake project file is missing the Qt packages. You have to add:

find_package( Qt5Core REQUIRED )
find_package( Qt5Widgets REQUIRED )
find_package( Qt5Gui REQUIRED )

and then

qt5_use_modules( MyTest Core Widgets Gui )

In addition to @tomvodi's answer, you can use a simpler syntax :

find_package(Qt5 REQUIRED COMPONENTS Core Widgets Gui). Then, you don't call qt5_use_modules but instead use the standard command to link :

target_link_libraries(MyTest Qt5::Core Qt5::Widgets Qt5::Gui)

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!