undefined reference to `ros::init(int&, char**, std::string const&, unsigned int)'
Hi,
I was trying to build ros package but while doing catkin_make, I am getting error
undefined reference to `ros::init(int&, char**, std::string const&, unsigned int)'
I followed the tutorial exactly as mentioned on Markers: Sending Basic Shapes (C++) but still I am not able to build the package. I looked up online but most of forums state the problems which is not present with my code.
While creating package I used command:
catkin_create_pkg using_markers roscpp visualization_msgs
I have added target_link_libraries(basic_shapes ${catkin_LIBRARIES})
in CMakeLists.txt
as well. In spite of that, I am getting undefined reference.
Note: I am using Jade distribution of ROS.
Edit: Content of CMakeLists.txt:
cmake_minimum_required(VERSION 2.8.3)
project(using_markers)
add_executable(basic_shapes src/basic_shapes.cpp)
target_link_libraries(basic_shapes ${catkin_LIBRARIES})
## 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
visualization_msgs
)
###################################
## catkin specific configuration ##
###################################
## The catkin_package macro generates cmake config files for your package
## Declare things to be passed to dependent projects
## INCLUDE_DIRS: uncomment this if you package contains header files
## 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 using_markers
# CATKIN_DEPENDS roscpp visualization_msgs
# DEPENDS system_lib
)
###########
## Build ##
###########
## Specify additional locations of header files
## Your package locations should be listed before other locations
# include_directories(include)
include_directories(
${catkin_INCLUDE_DIRS}
)
Any insight in this regard will be helpful.
Thanks.
It would be helpful if you can post your CMakeLists.txt file content.
I have edited question details and added the content of CMakeLists.txt