ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Qt Libraries?

asked 2012-04-02 09:03:39 -0600

allenh1 gravatar image

updated 2014-01-28 17:11:51 -0600

ngrennan gravatar image

Hello all,

I am trying to use the QString library in my code. I am not making a GUI, I just want to use some of the Qt libraries... Can anyone help me with this? Here is my solution in the CMakeLists.txt file [not working]:

cmake_minimum_required(VERSION 2.4.6)
find_package(Qt4 COMPONENTS QtCore QtGui)
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(example examples/example.cpp)
#target_link_libraries(example ${PROJECT_NAME})
rosbuild_add_executable(laser_test src/laser_test.cc)

Thanks,

-Hunter A.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
5

answered 2012-04-02 12:02:17 -0600

William gravatar image

You need to tell cmake where the Qt headers are and link against the Qt libraries you need. This site is helpful:

http://qt-project.org/quarterly/view/using_cmake_to_build_qt_projects

You will need to do something like this:

INCLUDE(${QT_USE_FILE})
ADD_DEFINITIONS(${QT_DEFINITIONS})

And:

TARGET_LINK_LIBRARIES(laser_test ${QT_LIBRARIES})

After the find_package call.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2012-04-02 09:03:39 -0600

Seen: 1,204 times

Last updated: Apr 02 '12