0
$\begingroup$

Rosanswers logo

I have built this node before with out problems, but now it won't make. I am using Hydro, on Ubuntu 12.4. Here is the error that I get:

leaf@leaf:~$ cd catkin_ws
leaf@leaf:~/catkin_ws$ catkin_make
Base path: /home/leaf/catkin_ws
Source space: /home/leaf/catkin_ws/src
Build space: /home/leaf/catkin_ws/build
Devel space: /home/leaf/catkin_ws/devel
Install space: /home/leaf/catkin_ws/install
####
#### Running command: "make cmake_check_build_system" in "/home/leaf/catkin_ws/build"
####
####
#### Running command: "make -j2 -l2" in "/home/leaf/catkin_ws/build"
####
[  3%] Built target leaf_teleop_joystick
[  3%] Built target nav_msgs_generate_messages_lisp
Linking CXX executable /home/leaf/catkin_ws/devel/lib/leaf_base/leaf_base
[  3%] Built target std_msgs_generate_messages_lisp
[  3%] Built target geometry_msgs_generate_messages_lisp
[  3%] Built target nav_msgs_generate_messages_py
[  3%] Built target std_msgs_generate_messages_py
[  3%] Built target geometry_msgs_generate_messages_py
[  3%] Built target nav_msgs_generate_messages_cpp
[  3%] Built target std_msgs_generate_messages_cpp
[  3%] Built target geometry_msgs_generate_messages_cpp
[  7%] Built target leaf_socket
[ 22%] Built target leaf_socket_generate_messages_py
[ 33%] Built target leaf_socket_generate_messages_cpp
[ 44%] Built target leaf_socket_generate_messages_lisp
[ 51%] Built target neato_laser_publisher
[ 62%] Built target leaf_base_generate_messages_lisp
[ 77%] Built target leaf_base_generate_messages_py
[ 88%] Built target leaf_base_generate_messages_cpp
[ 88%] Built target leaf_socket_generate_messages
[ 88%] Built target leaf_base_generate_messages
CMakeFiles/leaf_base.dir/src/DataConversion.cpp.o: In function `Leaf_dataConvert()':
DataConversion.cpp:(.text+0x311): undefined reference to `FwdSeqnum'
DataConversion.cpp:(.text+0x326): undefined reference to `LispFwdModeDone'
DataConversion.cpp:(.text+0x330): undefined reference to `TurnSeqnum'
DataConversion.cpp:(.text+0x345): undefined reference to `LispTurnModeDone'
DataConversion.cpp:(.text+0x514): undefined reference to `LispFwdModeDone'
DataConversion.cpp:(.text+0x51e): undefined reference to `LispTurnModeDone'
DataConversion.cpp:(.text+0x528): undefined reference to `CmdsMsg'
collect2: ld returned 1 exit status
make[2]: *** [/home/leaf/catkin_ws/devel/lib/leaf_base/leaf_base] Error 1
make[1]: *** [leaf_base/CMakeFiles/leaf_base.dir/all] Error 2
make: *** [all] Error 2
Invoking "make" failed
leaf@leaf:~/catkin_ws$ 

Here is my CMake file:

cmake_minimum_required(VERSION 2.8.3)
project(leaf_base)

## 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 nav_msgs roscpp rospy std_msgs tf message_generation)

## 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 global scripts declared therein get installed
## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html
# catkin_python_setup()

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

## Generate messages in the 'msg' folder
 add_message_files(
   FILES
   Leaf_cmds.msg
   Leaf_data.msg
   Leaf_emot.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
   geometry_msgs   nav_msgs   std_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 leaf_base
#  CATKIN_DEPENDS geometry_msgs nav_msgs roscpp rospy std_msgs tf
   CATKIN_DEPENDS  message_runtime
#  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}
)

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

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

## Add cmake target dependencies of the executable/library
## as an example, message headers may need to be generated before nodes
# add_dependencies(leaf_base_node leaf_base_generate_messages_cpp)

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

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

# all install targets should use catkin DESTINATION variables
# See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html

## Mark executable scripts (Python etc.) for installation
## in contrast to setup.py, you can choose the destination
# install(PROGRAMS
#   scripts/my_python_script
#   DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
# )

## Mark executables and/or libraries for installation
# install(TARGETS leaf_base leaf_base_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}-test test/test_leaf_base.cpp)
# if(TARGET ${PROJECT_NAME}-test)
#   target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME})
# endif()

## Add folders to be run by python nosetests
# catkin_add_nosetests(test)

add_executable(leaf_base src/Leaf_base.cpp src/ReadConfiguration.cpp src/DataConversion.cpp)
target_link_libraries(leaf_base ${catkin_LIBRARIES})
add_dependencies(leaf_base leaf_base_generate_message_cpp)

Like I say I have built this node before on same machine with out problems.

I do appreciate your time and help.

package.xml

-

leaf_base

0.0.0

The leaf_base package

Jane Doe -->

Alex Brown

MIT

http://ros.org/wiki/leaf_base --> Jane Doe -->

<build_depend>message_generation</build_depend>

catkin -->

<run_depend>message_runtime</run_depend>

gtest -->

<buildtool_depend>catkin</buildtool_depend>

<build_depend>geometry_msgs</build_depend>

<build_depend>nav_msgs</build_depend>

<build_depend>roscpp</build_depend>

<build_depend>rospy</build_depend>

<build_depend>std_msgs</build_depend>

<build_depend>tf</build_depend>

<run_depend>geometry_msgs</run_depend>

<run_depend>nav_msgs</run_depend>

<run_depend>roscpp</run_depend>

<run_depend>rospy</run_depend>

<run_depend>std_msgs</run_depend>

<run_depend>tf</run_depend>

-

-->

Originally posted by Morpheus on ROS Answers with karma: 111 on 2015-11-10

Post score: 0


Original comments

Comment by NEngelhard on 2015-11-10:
Could you remove the comments from the CMakeLists? It's hard to read if ~90% are ignored.

Comment by Morpheus on 2015-11-10:
Have added package.xml

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

This looks like a generic C++ error. I believe this is happening because you declare things like FwdSeqnum (and use them in the function Leaf_dataConvert()) but you never include or link against anything which defines them, see:

http://www.cprogramming.com/declare_vs_define.html

The solution will be to link your executable against an additional library which you are currently not linking against and provides the definition of these missing symbols or changing your code so that the declarations and definitions of your functions match.


Originally posted by William with karma: 17335 on 2015-11-10

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by Morpheus on 2015-11-10:
The strange thing is that it has worked fine before as it is. Could some ROS dependency have been lost?

Comment by William on 2015-11-10:
You might not be finding and using a dependency that the rosmake package was using? Check each of the dependencies of the package and look at the manifest.xml for each of them and look for link flags in the export section as a hint.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.