ROS Resources: Documentation | Support | Discussion Forum | Service Status | Q&A
Ask Your Question

Qt Libraries?

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

allenh1 gravatar image

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

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)

# 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(example examples/example.cpp)
#target_link_libraries(example ${PROJECT_NAME})
rosbuild_add_executable(laser_test src/


-Hunter A.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

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

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:

You will need to do something like this:




After the find_package call.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

The deadline to submit a proposal to present at ROSCon 2017 is June 25, 2017. Submit yours now!

Question Tools



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

Seen: 755 times

Last updated: Apr 02 '12