Ask Your Question
0

Qt Libraries?

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

allenh1 gravatar image allenh1 flag of United States
1007 39 46 63
http://eecs.vanderbilt.ed...

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 delete

1 Answer

Sort by ยป oldest newest most voted
5

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

William gravatar image William
2218 13 29 57
http://williamjwoodall.co...

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 publish link more

Your answer

Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

subscribe to rss feed

Stats

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

Seen: 215 times

Last updated: Apr 02 '12