Ошибка при попытке импортировать QuickControlsC++

Программы на C++. Форум разработчиков
Ответить
Гость
 Ошибка при попытке импортировать QuickControls

Сообщение Гость »


Я хочу создать проект с помощью Cmake в Ubuntu.

Мой CMakeList:
< бр />

Код: Выделить всё

cmake_minimum_required(VERSION 2.8.3)
project(client_ros)

find_package(catkin REQUIRED COMPONENTS
roscpp
std_msgs
qt_build
)

file(GLOB_RECURSE SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
FOLLOW_SYMLINKS src/*.cpp include/client_ros/*.hpp
include/client_ros/*.h)
file(GLOB QT_RESOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
resources/*.qrc)
include_directories(include ${catkin_INCLUDE_DIRS})
#################################
find_package(Qt5Core REQUIRED)
find_package(Qt5Sql REQUIRED)
find_package(Qt5Widgets REQUIRED)
find_package(Qt5Quick REQUIRED)
find_package(Qt5Multimedia REQUIRED)

find_package(Qt5Qml REQUIRED)

set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)

#set configs
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)

QT5_ADD_RESOURCES(QT_RESOURCES_CPP ${QT_RESOURCES})
QT5_WRAP_UI(QT_FORMS_HPP ${QT_FORMS})
QT5_WRAP_CPP(QT_MOC_HPP ${QT_MOC})
include_directories(
${Qt5Core_INCLUDE_DIRS}
${Qt5Gui_INCLUDE_DIRS}
${Qt5Quick_INCLUDE_DIRS}
${Qt5QuickControls2_INCLUDE_DIRS}
${Qt5Widgets_INCLUDE_DIRS}
${Qt5PrintSupport_INCLUDE_DIRS}
${Qt5Qml_INCLUDE_DIRS}
# ./src
${Qt5Sql_INCLUDE_DIRS}
${Qt5Charts_INCLUDE_DIRS}
${Qt5Multimedia_INCLUDE_DIRS}
${QT_INCLUDE_DIR}
)

add_definitions( -std=c++11 -fPIC)
add_definitions(${Qt5Widgets_DEFINITIONS} ${QtQml_DEFINITIONS}
${${Qt5Quick_DEFINITIONS}})

catkin_package(
INCLUDE_DIRS
include
CATKIN_DEPENDS
std_msgs
roscpp

)
include_directories(include)
include_directories(${catkin_INCLUDE_DIRS})
include_directories(${Eigen_INCLUDE_DIRS})

add_executable(client_ros_node src/client_ros_node.cpp
src/clientclass.cpp
include/client_ros/clientclass.h
${coreheaders}
${corecpps}
)
#qt5_use_modules(gui Quick Core)
add_library(${PROJECT_NAME}

${QT_SOURCES}
${QT_MOC_HPP}
${QT_RESOURCES_CPP}
${QT_MOC}
${QT_UI_H}
)
target_link_libraries(client_ros_node ${catkin_LIBRARIES})
target_link_libraries(client_ros_node
Qt5::Core
Qt5::Widgets
Qt5::Quick
Qt5::Sql
Qt5::Multimedia
)
add_dependencies(client_ros_node
client_ros_generate_messages_cpp_qt_build)

qt5_add_resources(qml_QRC resources/qml.qrc)
qt5_use_modules(client_ros_node Quick Gui Core Widgets)

## Mark cpp header files for installation
install(DIRECTORY include/client_ros/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
FILES_MATCHING PATTERN "*.h"
)
I get the following error:


QQmlApplicationEngine failed to load component
file:///home/amir/work_space/build/client_ros/devel/lib/client_ros/main.qml:1
module "QtQuick" version 2.9 is not installed


when i add find_package(Qt5QuickControls2 REQUIRED), I get the following error:


/home/amir/work_space/src/client_ros/CMakeLists.txt:19: error: By not
providing "FindQt5QuickControls2.cmake" in CMAKE_MODULE_PATH this
project has asked CMake to find a package configuration file provided
by "Qt5QuickControls2", but CMake did not find one. Could not find a
package configuration file provided by "Qt5QuickControls2" with any of
the following names: Qt5QuickControls2Config.cmake
qt5quickcontrols2-config.cmake Add the installation prefix of
"Qt5QuickControls2" to CMAKE_PREFIX_PATH or set
"Qt5QuickControls2_DIR" to a directory containing one of the above
files. If "Qt5QuickControls2" provides a separate development package
or SDK, be sure it has been installed.


Источник: https://stackoverflow.com/questions/501 ... ckcontrols
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «C++»