How to use qt libraries in ros
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)
INCLUDE(${QT_USE_FILE})
ADD_DEFINITIONS(${QT_DEFINITIONS})
include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)
# 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)
rosbuild_init()
#set the default path for built executables to the "bin" directory
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
#set the default path for built libraries to the "lib" directory
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
#uncomment if you have defined messages
#rosbuild_genmsg()
#uncomment if you have defined services
#rosbuild_gensrv()
#common commands for building c++ executables and libraries
#rosbuild_add_library(${PROJECT_NAME} src/example.cpp)
#target_link_libraries(${PROJECT_NAME} another_library)
#rosbuild_add_boost_directories()
#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