Ask Your Question

# Qt Libraries?

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 close merge delete ## 1 answer Sort by » oldest newest most voted 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.

more

## Your Answer

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

Add Answer

[hide preview]

## Stats

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

Seen: 554 times

Last updated: Apr 02 '12