Invoking "make –-pkg chapter2_tutorials -j1 -l1" failed

asked 2017-02-19 10:08:03 -0600

hyperrjas gravatar image

example1_a.cpp

include "ros/ros.h"
#include "std_msgs/String.h"
#include <sstream>
int main(int argc, char **argv)
{
  ros::init(argc, argv, "example1_a");
  ros::NodeHandle n;
  ros::Publisher pub = n.advertise<std_msgs::String>("message", 1000);
  ros::Rate loop_rate(10);
  while (ros::ok())
  {
    std_msgs::String msg;
    std::stringstream ss;
    ss << " I am the example1_a node ";
    msg.data = ss.str();
    //ROS_INFO("%s", msg.data.c_str());
    pub.publish(msg);
    ros::spinOnce();
    loop_rate.sleep();
  }
  return 0;
}

example1_b.cpp

#include "ros/ros.h"
#include "std_msgs/String.h"

void messageCallback(const std_msgs::String::ConstPtr& msg)
{
  ROS_INFO("I heard: [%s]", msg->data.c_str());
}

int main(int argc, char **argv)
{
  ros::init(argc, argv, "example1_b");
  ros::NodeHandle n;
  ros::Subscriber sub = n.subscribe("message", 1000, messageCallback);
  ros::spin();
  return 0;
}

Error when catkin_make –-pkg chapter2_tutorials:

#### Running command: "make cmake_check_build_system" in "/home/ros/catkin_ws/build"
####
####
#### Running command: "make –-pkg chapter2_tutorials -j1 -l1" in "/home/ros/catkin_ws/build"
####
make: *** No rule to make target '–-pkg'.  Stop.
Invoking "make –-pkg chapter2_tutorials -j1 -l1" failed

thanks!

edit retag flag offensive close merge delete