QML in CMakeList, ROS Project doesn't accept Quick Widget
-
We work on a ROS project and trying to make an interface for the robot.
But ROS doesn't accept quick widget, how can we solve that problem?
CMakeFiles/talker_wig.dir/src/mainwindow.cpp.o: In function `MainWindow::MainWindow(QWidget*)': mainwindow.cpp:(.text+0x200): undefined reference to `QQuickWidget::setSource(QUrl const&)' CMakeFiles/talker_wig.dir/src/mainwindow.cpp.o: In function `Ui_MainWindow::setupUi(QMainWindow*)': mainwindow.cpp:(.text._ZN13Ui_MainWindow7setupUiEP11QMainWindow[_ZN13Ui_MainWindow7setupUiEP11QMainWindow]+0x2f8): undefined reference to `QQuickWidget::QQuickWidget(QWidget*)' mainwindow.cpp:(.text._ZN13Ui_MainWindow7setupUiEP11QMainWindow[_ZN13Ui_MainWindow7setupUiEP11QMainWindow]+0x46d): undefined reference to `QQuickWidget::setResizeMode(QQuickWidget::ResizeMode)' collect2: error: ld returned 1 exit status ROS-QML-Deneme-V4/ROS_QML_Example-master/CMakeFiles/talker_wig.dir/build.make:195: recipe for target '/home/aliemre/QTCreator_Files/aliemre_ws/devel/lib/sabun/talker_wig' failed make[2]: *** [/home/aliemre/QTCreator_Files/aliemre_ws/devel/lib/sabun/talker_wig] Error 1 CMakeFiles/Makefile2:528: recipe for target 'ROS-QML-Deneme-V4/ROS_QML_Example-master/CMakeFiles/talker_wig.dir/all' failed make[1]: *** [ROS-QML-Deneme-V4/ROS_QML_Example-master/CMakeFiles/talker_wig.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs.... CMakeFiles/listener_wig.dir/src/mainwindow.cpp.o: In function `MainWindow::MainWindow(QWidget*)': mainwindow.cpp:(.text+0x200): undefined reference to `QQuickWidget::setSource(QUrl const&)' CMakeFiles/listener_wig.dir/src/mainwindow.cpp.o: In function `Ui_MainWindow::setupUi(QMainWindow*)': mainwindow.cpp:(.text._ZN13Ui_MainWindow7setupUiEP11QMainWindow[_ZN13Ui_MainWindow7setupUiEP11QMainWindow]+0x2f8): undefined reference to `QQuickWidget::QQuickWidget(QWidget*)' mainwindow.cpp:(.text._ZN13Ui_MainWindow7setupUiEP11QMainWindow[_ZN13Ui_MainWindow7setupUiEP11QMainWindow]+0x46d): undefined reference to `QQuickWidget::setResizeMode(QQuickWidget::ResizeMode)' collect2: error: ld returned 1 exit status ROS-QML-Deneme-V4/ROS_QML_Example-master/CMakeFiles/listener_wig.dir/build.make:195: recipe for target '/home/aliemre/QTCreator_Files/aliemre_ws/devel/lib/sabun/listener_wig' failed make[2]: *** [/home/aliemre/QTCreator_Files/aliemre_ws/devel/lib/sabun/listener_wig] Error 1 CMakeFiles/Makefile2:424: recipe for target 'ROS-QML-Deneme-V4/ROS_QML_Example-master/CMakeFiles/listener_wig.dir/all' failed make[1]: *** [ROS-QML-Deneme-V4/ROS_QML_Example-master/CMakeFiles/listener_wig.dir/all] Error 2 Makefile:145: recipe for target 'all' failed make: *** [all] Error 2 Invoking "make -j8 -l8" failed
-
@aliemrenebiler said in QML in CMakeList, ROS Project doesn't accept Quick Widget:
I can share the complete CMakeList File:
I am not familiar with
cmake
, I am usingqmake
so I can only guess.
I have always see incmake
projects thatREQUIRED
is the last parameter infind_package()
.
I would change:find_package(Qt5 REQUIRED COMPONENTS Core Qml Quick Widgets Multimedia )
to
find_package(Qt5 COMPONENTS Core Qml Quick Widgets Multimedia REQUIRED )
But, as written before, I don't know if it will change anything.
-
@aliemrenebiler said in QML in CMakeList, ROS Project doesn't accept Quick Widget:
But ROS doesn't accept quick widget, how can we solve that problem?
Which Qt Kit are you using?
Are you sureQWidget
is build for this kit?
Have you importQWidget
module?
For example, with Qt5 you should havefind_package(Qt5 COMPONENTS Widgets REQUIRED)
in your project file -
@KroMignon I don't know how to check the kit but if you tell me I can look.
We use Quick Widget, not QWidget, because it is way easier to implement camera.
I can share the complete CMakeList File:
cmake_minimum_required(VERSION 2.8.3) project(sabun) ## Compile as C++11, supported in ROS Kinetic and newer add_compile_options(-std=c++11) ## Find catkin macros and libraries find_package(catkin REQUIRED COMPONENTS roscpp std_msgs ) # Find Qt5 libraries find_package(Qt5 REQUIRED COMPONENTS Core Qml Quick Widgets Multimedia ) # Configuration to make Qt compiles go smoother set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_AUTOMOC ON) include_directories( ${CMAKE_BINARY_DIR} ) # Configure Catkin dependencies catkin_package( CATKIN_DEPENDS roscpp std_msgs ) include_directories( include ${catkin_INCLUDE_DIRS} ) ############################### # Basic, non-qt talker/listener add_executable(listener src/listener.cpp) add_executable(talker src/talker.cpp) target_link_libraries(listener ${catkin_LIBRARIES} ) target_link_libraries(talker ${catkin_LIBRARIES} ) ################################################ # Cmd line talker/listener running qt event loop add_executable(listener_qt src/listener_qt.cpp) add_executable(talker_qt src/talker_qt.cpp) # Configure Qt5 Modules # Equivalent to doing # Qt += Core # In Qt .pro file qt5_use_modules(listener_qt Core) qt5_use_modules(talker_qt Core) target_link_libraries(listener_qt ${catkin_LIBRARIES} ) target_link_libraries(talker_qt ${catkin_LIBRARIES} ) ###################################### # Talker and Listener using QML gui # Run MOC on headers of Q_OBJECT classes set(MOC_HDRS include/qml_mediator.h) qt5_wrap_cpp(MOC_SRCS ${MOC_HDRS}) # Run RCC on QRC file set(RCC_FILES src/display.qrc) qt5_add_resources(RCC_SOURCES ${RCC_FILES}) # Build executables with source, MOC result files, RCC result files add_executable(listener_qml src/listener_qml.cpp ${MOC_SRCS} ${RCC_SOURCES}) add_executable(talker_qml src/talker_qml.cpp ${MOC_SRCS} ${RCC_SOURCES}) # Configure Qt5 Modules # Equivalent to doing # Qt += Core Qml Quick # In Qt .pro file qt5_use_modules(listener_qml Core Qml Quick) qt5_use_modules(talker_qml Core Qml Quick) target_link_libraries(listener_qml ${catkin_LIBRARIES} ) target_link_libraries(talker_qml ${catkin_LIBRARIES} ) ######################################## # Talker and Listener using QWidgets gui # Run MOC on headers of Q_OBJECT classes set(MOC_HDRS include/mainwindow.h) qt5_wrap_cpp(MOC_SRCS ${MOC_HDRS}) # Run UIC on ui definitions set(UI_FILES ui/mainwindow.ui) qt5_wrap_ui(UI_SRCS ${UI_FILES}) # Build executables with source, MOC result files, UIC result files add_executable(talker_wig src/talker_wig.cpp src/mainwindow.cpp ${MOC_SRCS} ${UI_SRCS}) add_executable(listener_wig src/listener_wig.cpp src/mainwindow.cpp ${MOC_SRCS} ${UI_SRCS}) # Configure Qt5 Modules # Equivalent to doing # Qt += Core Widgets # In Qt .pro file qt5_use_modules(talker_wig Core Widgets Multimedia) qt5_use_modules(listener_wig Core Widgets Multimedia) target_link_libraries(talker_wig ${catkin_LIBRARIES} ) target_link_libraries(listener_wig ${catkin_LIBRARIES} )
-
@aliemrenebiler said in QML in CMakeList, ROS Project doesn't accept Quick Widget:
I can share the complete CMakeList File:
I am not familiar with
cmake
, I am usingqmake
so I can only guess.
I have always see incmake
projects thatREQUIRED
is the last parameter infind_package()
.
I would change:find_package(Qt5 REQUIRED COMPONENTS Core Qml Quick Widgets Multimedia )
to
find_package(Qt5 COMPONENTS Core Qml Quick Widgets Multimedia REQUIRED )
But, as written before, I don't know if it will change anything.
-
@aliemrenebiler add Qt include and lib paths of each compoment with a loop.
include_directories(${Qt5${component}_INCLUDE_DIRS})
add_definitions(${Qt5${component}_DEFINITIONS})
target_link_libraries(${PROJECT_NAME} Qt5::${component})