当你在使用automoc工具为linuxdeployqt目标生成moc文件时,如果遇到“could not find moc executable target qt5::”的错误,这通常意味着系统无法找到Qt5的moc(Meta-Object Compiler)工具。以下是一些可能的解决步骤: 确认Qt5安装: 确保你的系统中已经安装了Qt5,并且moc工具是可用的。你可以通过命令行尝试直接运行moc...
set(CMAKE_INCLUDE_CURRENT_DIR ON) # 自动运行moc set(CMAKE_AUTOMOC ON) # 自动运行uic set(CMAKE_AUTOUIC ON) # 自动运行rcc set(CMAKE_AUTORCC ON) # 生成可执行文件 add_executable(main main.cc) # 链接库 target_link_libraries(main Qt4::QtCore Qt4::QtGui) 1. 2. 3. 4. 5. 6. 7....
(CMAKE_WIN32_EXECUTABLE ON) endif() # Find the QtWidgets library find_package(Qt5 REQUIRED COMPONENTS Widgets) # Tell CMake to create the helloworld executable add_executable(helloworld main.cpp mainwindow.cpp mainwindow.ui resources.qrc) # Add the Qt5 Widgets for linking target_link_...