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

Tutorial Trouble - Markers Basic Shapes

asked 2016-03-06 12:32:09 -0500

jacksonkr_ gravatar image

updated 2016-03-09 10:12:41 -0500

I'm not new to programming, but I am new to building without an IDE doing all the work. Why is this failing?

Tutorial:

http://wiki.ros.org/rviz/Tutorials/Ma...

Build error:

$ catkin_make
Base path: /home/jackson/ros_catkin_ws
Source space: /home/jackson/ros_catkin_ws/src
Build space: /home/jackson/ros_catkin_ws/build
Devel space: /home/jackson/ros_catkin_ws/devel
Install space: /home/jackson/ros_catkin_ws/install
####
#### Running command: "cmake /home/jackson/ros_catkin_ws/src -DCATKIN_DEVEL_PREFIX=/home/jackson/ros_catkin_ws/devel -DCMAKE_INSTALL_PREFIX=/home/jackson/ros_catkin_ws/install -G Unix Makefiles" in "/home/jackson/ros_catkin_ws/build"
####
-- Using CATKIN_DEVEL_PREFIX: /home/jackson/ros_catkin_ws/devel
-- Using CMAKE_PREFIX_PATH: /home/jackson/ros_catkin_ws/devel;/opt/ros/indigo
-- This workspace overlays: /home/jackson/ros_catkin_ws/devel;/opt/ros/indigo
-- Using PYTHON_EXECUTABLE: /usr/bin/python
-- Using Debian Python package layout
-- Using empy: /usr/bin/empy
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/jackson/ros_catkin_ws/build/test_results
-- Found gtest sources under '/usr/src/gtest': gtests will be built
-- Using Python nosetests: /usr/bin/nosetests-2.7
-- catkin 0.6.16
-- BUILD_SHARED_LIBS is on
WARNING: Package "libg2o" does not follow the version conventions. It should not contain leading zeros (unless the number is 0).
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- ~~  traversing 2 packages in topological order:
-- ~~  - using_markers
-- ~~  - beginner_tutorials
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- +++ processing catkin package: 'using_markers'
-- ==> add_subdirectory(using_markers)
-- +++ processing catkin package: 'beginner_tutorials'
-- ==> add_subdirectory(beginner_tutorials)
-- Using these message generators: gencpp;genlisp;genpy
-- beginner_tutorials: 1 messages, 1 services
-- Configuring done
-- Generating done
-- Build files have been written to: /home/jackson/ros_catkin_ws/build
####
#### Running command: "make -j2 -l2" in "/home/jackson/ros_catkin_ws/build"
####
Scanning dependencies of target basic_shapes
[  7%] [  7%] Built target _beginner_tutorials_generate_messages_check_deps_AddTwoInts
Building CXX object using_markers/CMakeFiles/basic_shapes.dir/src/basic_shapes.cpp.o
[  7%] Built target _beginner_tutorials_generate_messages_check_deps_Num
Scanning dependencies of target std_msgs_generate_messages_cpp
[  7%] Built target std_msgs_generate_messages_cpp
Scanning dependencies of target std_msgs_generate_messages_lisp
[  7%] Built target std_msgs_generate_messages_lisp
Scanning dependencies of target std_msgs_generate_messages_py
[  7%] Built target std_msgs_generate_messages_py
[ 15%] Built target listener
[ 30%] Built target beginner_tutorials_generate_messages_cpp
[ 46%] Built target beginner_tutorials_generate_messages_lisp
[ 76%] Built target beginner_tutorials_generate_messages_py
[ 84%] Built target talker
[ 84%] Built target beginner_tutorials_gencpp
[ 84%] Built target beginner_tutorials_generate_messages
[ 92%] Built target add_two_ints_client
[100%] Built target add_two_ints_server
Linking CXX executable /home/jackson/ros_catkin_ws/devel/lib/using_markers/basic_shapes
CMakeFiles/basic_shapes.dir/src/basic_shapes.cpp.o: In function `main':
basic_shapes.cpp:(.text+0x63): undefined reference to `ros::init(int&, char**, std::string const&, unsigned int)'
basic_shapes.cpp:(.text+0xbf): undefined reference to `ros::NodeHandle::NodeHandle(std::string const&, std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > > const&)'
basic_shapes.cpp:(.text+0x2e1): undefined reference to `ros::ok()'
basic_shapes.cpp:(.text+0x2ff): undefined reference to `ros::console::g_initialized'
basic_shapes.cpp:(.text+0x30f): undefined reference to `ros::console::initialize()'
basic_shapes.cpp:(.text+0x364): undefined reference to `ros::console::initializeLogLocation(ros::console::LogLocation*, std::string const&, ros::console::levels::Level)'
basic_shapes.cpp:(.text+0x3a5): undefined reference to `ros::console::setLogLocationLevel(ros::console::LogLocation*, ros::console::levels::Level)'
basic_shapes.cpp:(.text+0x3af): undefined reference to `ros::console::checkLogLocationEnabled(ros::console::LogLocation*)'
basic_shapes.cpp:(.text+0x419): undefined reference to `ros::console::print(ros::console::FilterBase*, void*, ros::console::levels::Level, char const*, int, char const ...
(more)
edit retag flag offensive close merge delete

Comments

Did you edit the CMakeLists.txt as explained at the very bottom of section 4.1 of the tutorial? You need to tell CMake which libraries you should link..

If you did follow this step and it does not work, please post your CMakeLists.txt.

mgruhler gravatar image mgruhler  ( 2016-03-09 01:15:00 -0500 )edit

@mig I added the CMakeLists.txt to the bottom of the original question. I'm thinking the issue may be that I don't have <visualization_msgs/Marker.h>. How can I verify that the Marker.h exists? I tried find /usr -iname "marker.h" and received nothing.

jacksonkr_ gravatar image jacksonkr_  ( 2016-03-09 10:15:42 -0500 )edit

1 Answer

Sort by » oldest newest most voted
1

answered 2016-03-10 01:13:34 -0500

mgruhler gravatar image

You don't have roscpp configured as a dependency, this is why you get all those linker errors to ros::.... This is, you didn't follow step 3 of the Tutorial correctly. You probably missed the roscpp part.

You need to add roscpp as a <build_depend> and a <run_depend> in the package.xml and in the find_package(catkin ... part in the CMakeLists.txt.

For more information, check out the catkin introduction here.

Also, ROS is installed in /opt/ros/<ROS_DISTRO>/, not in /usr.

edit flag offensive delete link more

Comments

I tried adding those nodes directly to the package.xml and it didn't work. I remade the package and violá. I can't believe I missed this. Thanks for your patience to show me my error, I really do appreciate that.

jacksonkr_ gravatar image jacksonkr_  ( 2016-03-11 09:01:26 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2016-03-06 12:32:09 -0500

Seen: 526 times

Last updated: Mar 10 '16