error: "invoking make failed"
hello, when I run catkin_make I get the following errors:
Scanning dependencies of target gira
[100%] Building CXX object prueba/CMakeFiles/gira.dir/src/gira.cpp.o
Linking CXX executable /home/turtlebot/catkin_ws/devel/lib/proyecto/gira
CMakeFiles/gira.dir/src/gira.cpp.o: In function `main':
gira.cpp:(.text+0x55): undefined reference to `ros::init(int&, char**, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, unsigned int)'
gira.cpp:(.text+0xa5): undefined reference to `ros::NodeHandle::NodeHandle...
any idea what could be the mistake? thanks
the executable gira.cpp:
#include "ros/ros.h"
#include "geometry_msgs/Twist.h"
int main(int argc, char **argv)
{
ros::init(argc, argv, "gira");
ros::NodeHandle n;
ros::Publisher vel_pub_=n.advertise<geometry_msgs::Twist>("cmd_vel", 1);
geometry_msgs::Twist vel;
ros::Rate loop_rate(10);
while (ros::ok())
{
vel.linear.x = 0.1; //velocidad de avance
vel.angular.z = 0.3; //velocidad de giro
vel_pub_.publish(vel);
loop_rate.sleep();
}
return 0;
}
the CMakeLists.txt (catkin specific configuration and built) :
cmake_minimum_required(VERSION 2.8.3) project(prueba)
find_package(catkin REQUIRED COMPONENTS geometry_msgs image_transport nav_msgs roscpp sensor_msgs std_msgs )
catkin_package( INCLUDE_DIRS include # LIBRARIES prueba # CATKIN_DEPENDS geometry_msgs image_transport nav_msgs roscpp sensor_msgs std_msgs turtlebot_node # DEPENDS system_lib ) ## Specify additional locations of header files ## Your package locations should be listed before other locations include_directories(include ${catkin_INCLUDE_DIRS} )
## Declare a cpp library # add_library(prueba # src/${PROJECT_NAME}/prueba.cpp # )
## Declare a cpp executable # add_executable(prueba_node src/prueba_node.cpp) add_executable(gira src/gira.cpp)
## Add cmake target dependencies of the executable/library ## as an example, message headers may need to be generated before nodes # add_dependencies(prueba_node prueba_generate_messages_cpp)
## Specify libraries to link a library or executable target against # target_link_libraries(prueba_node # ${catkin_LIBRARIES} # )
It seems that the problem is with your code. Without the code, its quite hard to figure out the solution to this problem