Open pl95 opened 4 years ago
According to https://packages.ubuntu.com/trusty/allpackages, Ubuntu 14.04 came with cmake 2.8.12. I don't think this old cmake version supports the Boost::X targets which I used for this CMakeLists.txt. Replacing them with the old style Boost_LIBRARIES macro should help, I think.
I did change to Boost_LIBRARIES. And I upgraded CMake to 3.2.2. It still has this error.
Can you drop your current CMakeLists.txt here?
Can you drop your current CMakeLists.txt here?
yes.
cmake_minimum_required(VERSION 3.1)
project(robot_localization_demo)
## Compile as C++11, supported in ROS Kinetic and newer
# add_compile_options(-std=c++11)
## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS
geometry_msgs
robot_localization
roscpp
tf2
turtlesim
)
## System dependencies are found with CMake's conventions
# find_package(Boost REQUIRED COMPONENTS system)
## Boost
#SET(Boost_USE_STATIC_LIBS ON)
#SET(Boost_USE_MULTITHREADED ON)
#find_package(Boost REQUIRED COMPONENTS program_options)
#include_directories(${Boost_INCLUDE_DIRS})
find_package(Boost 1.54.0 REQUIRED COMPONENTS program_options)
include_directories(${Boost_INCLUDE_DIRS})
link_directories(${Boost_LIBRARY_DIR})
## Uncomment this if the package has a setup.py. This macro ensures
## modules and global scripts declared therein get installed
## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html
# catkin_python_setup()
catkin_package(
INCLUDE_DIRS include
# LIBRARIES robot_localization_demo
CATKIN_DEPENDS roscpp tf2 robot_localization
# DEPENDS system_lib
)
###########
## Build ##
###########
## Specify additional locations of header files
## Your package locations should be listed before other locations
include_directories(
include
${catkin_INCLUDE_DIRS}
)
add_executable(positioning_system_node
src/sensors/positioning_system_node.cpp
src/sensors/positioning_system.cpp
)
target_link_libraries(positioning_system_node
${Boost_LIBRARIES}
Boost::program_options
)
add_executable(odometry_node
src/sensors/odometry_node.cpp
src/sensors/odometry.cpp
)
target_link_libraries(odometry_node
${Boost_LIBRARIES}
Boost::program_options
)
add_executable(transformation_visualization_node
src/transforms/transformation_visualization_node.cpp
)
target_link_libraries(transformation_visualization_node
${catkin_LIBRARIES}
)
Anything I can modified?
According to https://cmake.org/cmake/help/v3.2/module/FindBoost.html The FindBoost.cmake script that comes with CMake 3.2 doesn't yet support the Boost::X targets.
You already added the ${Boost_LIBRARIES}
, but you should remove the Boost::program_options
, so the target_link_libraries
should become:
target_link_libraries(positioning_system_node
${Boost_LIBRARIES}
)
and
target_link_libraries(odometry_node
${Boost_LIBRARIES}
)
Does this help?
@maartendemunck
It do help! But now there are new errors.
/home/marvin/catkin_ws/src/ros_robot_localization_tutorial/ros-ws/src/robot_localization_demo/src/transforms/transformation_visualization_node.cpp:71:10: error: ‘client’ does not name a type
auto client = node_handle.serviceClient<decltype(visualize_current_pose)>(visualization_turtle_name + "/teleport_absolute");
^
/home/marvin/catkin_ws/src/ros_robot_localization_tutorial/ros-ws/src/robot_localization_demo/src/transforms/transformation_visualization_node.cpp:72:5: error: ‘client’ was not declared in this scope
client.call(visualize_current_pose);
^
The C++ version is c++ (Ubuntu 5.5.0-12ubuntu1~14.04) 5.5.0 20171010
It this the reason?
Are you compiling in C++11 mode?
Try to uncomment the line
add_compile_options(-std=c++11)
too see if that helps.
@pl95 Did this solve the problem?
Are you compiling in C++11 mode?
Try to uncomment the line
add_compile_options(-std=c++11)
too see if that helps.
It works for me.
I am using Ubuntu 14.04 with ROS Inidgo. When I run $ catkin_make I have the following error; CMake Error at robot_localization_demo/CMakeLists.txt:176 (add_executable): Target "odometry_node" links to target "Boost::program_options" but the target was not found. Perhaps a find_package() call is missing for an IMPORTED target, or an ALIAS target is missing?
CMake Error at robot_localization_demo/CMakeLists.txt:167 (add_executable): Target "positioning_system_node" links to target "Boost::program_options" but the target was not found. Perhaps a find_package() call is missing for an IMPORTED target, or an ALIAS target is missing?
Any way to fix this?