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

groovy rosconsole error

asked 2013-01-09 22:48:21 -0500

Dickvdsteen gravatar image

I noticed ROS Groovy is no longer in beta and I wanted to try catkin with groovy. I am able to create a new package using catkin. Also i am able to include "ros/ros.h" in my code but whenever I use anything from ros I something get an error like:

beginner_tutorials_node.cpp:(.text+0x13): undefined reference to `ros::console::g_initialized'
beginner_tutorials_node.cpp:(.text+0x23): undefined reference to `ros::console::initialize()'
beginner_tutorials_node.cpp:(.text+0x6c): undefined reference to `ros::console::initializeLogLocation(ros::console::LogLocation*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, ros::console::levels::Level)'
beginner_tutorials_node.cpp:(.text+0xa7): undefined reference to `ros::console::setLogLocationLevel(ros::console::LogLocation*, ros::console::levels::Level)'
beginner_tutorials_node.cpp:(.text+0xb1): undefined reference to `ros::console::checkLogLocationEnabled(ros::console::LogLocation*)'
beginner_tutorials_node.cpp:(.text+0xfc): undefined reference to `ros::console::print(ros::console::FilterBase*, log4cxx::Logger*, ros::console::levels::Level, char const*, int, char const*, char const*, ...)'
collect2: ld returned 1 exit status

my code:

#include "ros/ros.h"
#include "ros/console.h"
#include "ros/assert.h"
#include "ros/static_assert.h"    

int main(int argc, char ** argv)
{
    ROS_INFO("string");
    return 0;
}

my cmake_lists.txt:

cmake_minimum_required(VERSION 2.8.3)
project(beginner_tutorials)

## 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 roscpp std_msgs rosconsole roscpp_serialization message_generation rostime)

## System dependencies are found with CMake's conventions
# find_package(Boost REQUIRED COMPONENTS system)

## Uncomment this if the package has a setup.py. This macro ensures
## modules and scripts declared therein get install#include <ros/console.h>ed
# catkin_python_setup()

#######################################
## Declare ROS messages and services ##
#######################################

## Generate messages in the 'msg' folder
# add_message_files(
#   FILES
#   Message1.msg
#   Message2.msg
# )

## Generate services in the 'srv' folder
# add_service_files(
#   FILES
#   Service1.srv
#   Service2.srv
# )

## Generate added messages and services with any dependencies listed here
# generate_messages(
#   DEPENDENCIES
#   std_msgs
# )

###################################################
## Declare things to be passed to other projects ##
###################################################

## LIBRARIES: libraries you create in this project that dependent projects also need
## CATKIN_DEPENDS: catkin_packages dependent projects also need
## DEPENDS: system dependencies of this project that dependent projects also need
catkin_package(
   INCLUDE_DIRS include
#  LIBRARIES beginner_tutorials
   CATKIN_DEPENDS roscpp std_msgs rosconsole roscpp_serialization message_generation rostime 
#  DEPENDS system_lib
)

###########
## Build ##
###########

## Specify additional locations of header files
include_directories(include
  ${catkin_INCLUDE_DIRS}
)

## Declare a cpp library
# add_library(beginner_tutorials
#   src/${PROJECT_NAME}/beginner_tutorials.cpp
# )

## Declare a cpp executable
 add_executable(beginner_tutorials_node src/beginner_tutorials_node.cpp)

## Add dependencies to the executable
# add_dependencies(beginner_tutorials_node ${PROJECT_NAME})

## Specify libraries to link a library or executable target against
# target_link_libraries(beginner_tutorials_node
#   ${catkin_LIBRARIES}
# )

#############
## Install ##
#############

## Mark executable scripts (Python etc.) for installation
## not required for python when using catkin_python_setup()
# install(PROGRAMS
#   scripts/my_python_script
#   DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
# )

## Mark executables and/or libraries for installation
# install(TARGETS beginner_tutorials beginner_tutorials_node
#   ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
#   LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
#   RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
# )

## Mark cpp header files for installation
# install(DIRECTORY include/${PROJECT_NAME}/
#   DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
#   FILES_MATCHING PATTERN "*.h"
#   PATTERN ".svn" EXCLUDE
# )

## Mark other files for installation (e.g. launch and bag files, etc.)
# install(FILES
#   # myfile1
#   # myfile2
#   DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
# )

#############
## Testing ##
#############

## Add gtest based cpp test target and link libraries
# catkin_add_gtest(${PROJECT_NAME ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2013-01-09 23:11:30 -0500

KruseT gravatar image

updated 2013-01-09 23:18:01 -0500

Those are linker errors. Uncomment the linker flag block

## Specify libraries to link a library or executable target against
# target_link_libraries(beginner_tutorials_node
#   ${catkin_LIBRARIES}
# )

That should fix it.

EdIT. The roscpp tutorials also have a catkin button that will guide you along the building process with catkin: http://www.ros.org/wiki/ROS/Tutorials/WritingPublisherSubscriber%28c%2B%2B%29

edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-01-09 22:48:21 -0500

Seen: 3,477 times

Last updated: Jan 09 '13