catkin_make recipe for target ' ' failed
I cannot run catkin_make command on ubuntu 16.04 and the output is as followed.
student@IAR-IPR-C1035:~/slamdog/catkin_ws$ catkin_make
Base path: /home/student/slamdog/catkin_ws
Source space: /home/student/slamdog/catkin_ws/src
Build space: /home/student/slamdog/catkin_ws/build
Devel space: /home/student/slamdog/catkin_ws/devel
Install space: /home/student/slamdog/catkin_ws/install
####
#### Running command: "make cmake_check_build_system" in "/home/student/slamdog/catkin_ws/build"
####
####
#### Running command: "make -j4 -l4" in "/home/student/slamdog/catkin_ws/build"
####
[ 0%] Built target actionlib_msgs_generate_messages_lisp
[ 0%] Built target geometry_msgs_generate_messages_py
[ 0%] Built target tf2_msgs_generate_messages_nodejs
[ 0%] Built target std_msgs_generate_messages_eus
[ 0%] Built target actionlib_msgs_generate_messages_eus
[ 0%] Built target std_msgs_generate_messages_py
[ 0%] Built target actionlib_msgs_generate_messages_nodejs
[ 0%] Built target geometry_msgs_generate_messages_cpp
[ 0%] Built target geometry_msgs_generate_messages_lisp
[ 0%] Built target std_msgs_generate_messages_lisp
[ 0%] Built target std_msgs_generate_messages_nodejs
[ 0%] Built target geometry_msgs_generate_messages_nodejs
[ 0%] Built target actionlib_msgs_generate_messages_cpp
[ 0%] Built target std_msgs_generate_messages_cpp
[ 0%] Built target tf2_msgs_generate_messages_cpp
[ 0%] Built target tf2_msgs_generate_messages_py
[ 0%] Built target tf2_msgs_generate_messages_eus
[ 0%] Built target geometry_msgs_generate_messages_eus
[ 0%] Built target tf2_msgs_generate_messages_lisp
[ 0%] Built target actionlib_msgs_generate_messages_py
[ 0%] Built target _slamdog_core_generate_messages_check_deps_SensorData
[ 16%] Built target slamdog_utils
[ 25%] Built target slamdog_core_generate_messages_nodejs
[ 41%] Built target slamdog_core_generate_messages_py
[ 50%] Built target slamdog_core_generate_messages_lisp
[ 66%] Built target slamdog_core_generate_messages_eus
[ 75%] Built target slamdog_core_generate_messages_cpp
[ 75%] Built target slamdog_core_generate_messages
[ 83%] Linking CXX executable /home/student/slamdog/catkin_ws/devel/lib/slamdog_core/slamdog_core
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
slamdog_core/CMakeFiles/slamdog_core.dir/build.make:141: recipe for target '/home/student/slamdog/catkin_ws/devel/lib/slamdog_core/slamdog_core' failed
make[2]: *** [/home/student/slamdog/catkin_ws/devel/lib/slamdog_core/slamdog_core] Error 1
CMakeFiles/Makefile2:1095: recipe for target 'slamdog_core/CMakeFiles/slamdog_core.dir/all' failed
make[1]: *** [slamdog_core/CMakeFiles/slamdog_core.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make -j4 -l4" failed
And my CMakeList is as followed.
cmake_minimum_required(VERSION 2.8.3)
project(slamdog)
set(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}")
## Add support for C++11, supporpigpioted in ROS Kinetic and newer
add_definitions(-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
roscpp
std_msgs
genmsg
message_generation
geometry_msgs
sensor_msgs
slamdog_utils
)
## Generate messages in the 'msg' folder
add_message_files(
FILES
SensorData.msg
)
## Generate added messages and services with any dependencies listed here
generate_messages(
DEPENDENCIES
std_msgs
geometry_msgs
)
site_name(HOSTNAME)
set(REPO "/home/student/slamdog")
if (${HOSTNAME} STREQUAL "bal-thinkpad")
set(REPO "/home/bal/Projects/kit/slamdog")
elseif (${HOSTNAME} STREQUAL "iar-ipr-c1146")
set(REPO "/home/heilig/slamdog_project/slamdog")
endif()
## Specify additional locations of header files
## Your package locations should be listed before other locations
include_directories(
include
${REPO}/slamdog_core/include
${catkin_INCLUDE_DIRS}
)
## Add cmake target dependencies of the library
## as an example, code may need to be generated before libraries
## either from message generation or dynamic reconfigure
## Declare a C++ executable
add_executable(slamdog_core src/SensorPublisher.cpp src/OdomPublisher.cpp)
## Add cmake target dependencies of the executable
target_link_libraries(slamdog_core ${catkin_LIBRARIES}) ##deleted ${SLAMDOG_HW_LIBRARY}
add_dependencies(slamdog_core ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGET} ${PROJECT_NAME}_msgs_generate_messages_cpp)
What should I do to fix this problem? Thanks a lot!
I believe the compiler is not finding a reference to
main()
anywhere. https://stackoverflow.com/questions/2...what does slamdog_core look like?
Thanks for your answer and I think the problem is the
main()
.slamdog_core is a package under catkin_ws/src as followed:
slamdog_core - include - slamdog_core - OdomPublisher.hpp - SensorPublisher.hpp - msg - SensorData.msg - src - OdomPublisher.cpp - SensorPublisher.cpp
I just want to make my target clearly so I named it as slamdog_core