Rosanswers logo

Hi dear I'm working with Ubuntu 12.10 and ros hydro I want to use qt libraries in ros. So I try to use simple library like "QDebug" and I write this program and Cmake

#include "QDebug"
#include "ros/ros.h"

int main(int argc, char** argv)
  ros::init(argc, argv, "Qt_test");
  qDebug()<<"Hello world";
    return 0;

and cmake file:

cmake_minimum_required(VERSION 2.4.6)
find_package(Qt4 COMPONENTS QtCore QtGui)


# Set the build type.  Options are:
#  Coverage       : w/ debug symbols, w/o optimization, w/ code-coverage
#  Debug          : w/ debug symbols, w/o optimization
#  Release        : w/o debug symbols, w/ optimization
#  RelWithDebInfo : w/ debug symbols, w/ optimization
#  MinSizeRel     : w/o debug symbols, w/ optimization, stripped binaries
#set(ROS_BUILD_TYPE RelWithDebInfo)


#set the default path for built executables to the "bin" directory
#set the default path for built libraries to the "lib" directory

#uncomment if you have defined messages
#uncomment if you have defined services

#common commands for building c++ executables and libraries
#rosbuild_add_library(${PROJECT_NAME} src/example.cpp)
#target_link_libraries(${PROJECT_NAME} another_library)
#rosbuild_link_boost(${PROJECT_NAME} thread)
rosbuild_add_executable(first_test src/first_test.cpp)
target_link_libraries(qt_test ${QT_LIBRARIES})

but when I try to make my package with rosmake this error occurd.

{------------------------------------------------------------------------------- mkdir -p bin cd build && cmake -Wdev -DCMAKE_TOOLCHAIN_FILE=/opt/ros/hydro/share/ros/core/rosbuild/rostoolchain.cmake .. [rosbuild] Building package qt_test -- Using CATKIN_DEVEL_PREFIX: /home/hamid/working_space/qt_test/build/devel -- Using CMAKE_PREFIX_PATH: /opt/ros/hydro -- This workspace overlays: /opt/ros/hydro -- Using Debian Python package layout -- Using CATKIN_ENABLE_TESTING: ON -- Skip enable_testing() for dry packages -- Using CATKIN_TEST_RESULTS_DIR: /home/hamid/working_space/qt_test/build/test_results -- Found gtest sources under '/usr/src/gtest': gtests will be built -- catkin 0.5.77 [rosbuild] Including /opt/ros/hydro/share/roslisp/rosbuild/roslisp.cmake [rosbuild] Including /opt/ros/hydro/share/roscpp/rosbuild/roscpp.cmake [rosbuild] Including /opt/ros/hydro/share/rospy/rosbuild/rospy.cmake CMake Error at CMakeLists.txt:34 (target_link_libraries): Cannot specify link libraries for target "qt_test" which is not built by this project.

 -- Configuring incomplete, errors occurred!


Is there anyone help me? I know about cmake a little.Could anyone give me link for cmake that how to do this? thanks a lot

Originally posted by Hamid Didari on ROS Answers with karma: 1769 on 2013-11-25

Post score: 0


1 Answer 1


Rosanswers logo

I found my problem rosbuild_add_executable(first_test src/first_test.cpp) target_link_libraries(qt_test ${QT_LIBRARIES}) Make both qt_test, or both first_test.

Originally posted by Hamid Didari with karma: 1769 on 2013-11-26

This answer was ACCEPTED on the original site

Post score: 4


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.