title: ROS rosmake error
body: <p>I am currently working on a project with ROS. I am completely new to ROS and it's features. Currently i'm doing a tutorial on ROS and started using code for the first time. although i do have some experience with c++, i can't figure out what is going wrong. In ROS i use the <em>rosmake</em> command and it fails to compile the cpp file/code. Can anyone help me figure out why the error occurs? (and possibly how to fix it?)</p>
  
  <p>below is the cpp file code:</p>
  
  <pre><code>#include "ros/ros.h"
  #include "std_msgs/String.h"
  #include &lt;sstream&gt;
  int main(int argc, char **argv)
  {
  ros::init(argc, argv, "example1_a");
  ros::NodeHandle n;
  ros::Publisher chatter_pub = n.advertise&lt;std_
  msgs::String&gt;("message", 1000);
  ros::Rate loop_rate(10);
  while (ros::ok())
  {
  std_msgs::String msg;
  std::stringstream ss;
  ss &lt;&lt; " I am the example1_a node ";
  msg.data = ss.str();
  //ROS_INFO("%s", msg.data.c_str());
  chatter_pub.publish(msg);
  ros::spinOnce();
  loop_rate.sleep();
  }
  return 0;
  }
  </code></pre>
  
  <p>And here the build log:</p>
  
  <pre><code>mkdir -p bin
  cd build &amp;&amp; cmake -Wdev -DCMAKE_TOOLCHAIN_FILE=/opt/ros/indigo/share/ros/core/rosbuild/rostoolchain.cmake  ..
  [rosbuild] Building package chapter2_tutorials
  [rosbuild] using multiarch 'x86_64-linux-gnu' for finding Boost
  -- Using CATKIN_DEVEL_PREFIX: /home/rospc/dev/rosbook/chapter2_tutorials/build/devel
  -- Using CMAKE_PREFIX_PATH: /opt/ros/indigo
  -- This workspace overlays: /opt/ros/indigo
  -- Using PYTHON_EXECUTABLE: /usr/bin/python
  -- Using Debian Python package layout
  -- Using empy: /usr/bin/empy
  -- Using CATKIN_ENABLE_TESTING: ON
  -- Skip enable_testing() for dry packages
  -- Using CATKIN_TEST_RESULTS_DIR: /home/rospc/dev/rosbook/chapter2_tutorials/build/test_results
  -- Found gtest sources under '/usr/src/gtest': gtests will be built
  -- Using Python nosetests: /usr/bin/nosetests-2.7
  -- catkin 0.6.16
  -- Using these message generators: gencpp;genlisp;genpy
  [rosbuild] Including /opt/ros/indigo/share/roslisp/rosbuild/roslisp.cmake
  [rosbuild] Including /opt/ros/indigo/share/roscpp/rosbuild/roscpp.cmake
  [rosbuild] Including /opt/ros/indigo/share/rospy/rosbuild/rospy.cmake
  -- Configuring done
  -- Generating done
  -- Build files have been written to: /home/rospc/dev/rosbook/chapter2_tutorials/build
  cd build &amp;&amp; make -j8 -l8
  make[1]: Entering directory `/home/rospc/dev/rosbook/chapter2_tutorials/build'
  make[2]: Entering directory `/home/rospc/dev/rosbook/chapter2_tutorials/build'
  make[3]: Entering directory `/home/rospc/dev/rosbook/chapter2_tutorials/build'
  make[3]: Leaving directory `/home/rospc/dev/rosbook/chapter2_tutorials/build'
  [  0%] Built target rospack_genmsg_libexe
  make[3]: Entering directory `/home/rospc/dev/rosbook/chapter2_tutorials/build'
  make[3]: Leaving directory `/home/rospc/dev/rosbook/chapter2_tutorials/build'
  [  0%] Built target rosbuild_precompile
  make[3]: Entering directory `/home/rospc/dev/rosbook/chapter2_tutorials/build'
  make[3]: Entering directory `/home/rospc/dev/rosbook/chapter2_tutorials/build'
  Scanning dependencies of target example1_a
  Scanning dependencies of target example1_b
  make[3]: Leaving directory `/home/rospc/dev/rosbook/chapter2_tutorials/build'
  make[3]: Leaving directory `/home/rospc/dev/rosbook/chapter2_tutorials/build'
  make[3]: Entering directory `/home/rospc/dev/rosbook/chapter2_tutorials/build'
  make[3]: Entering directory `/home/rospc/dev/rosbook/chapter2_tutorials/build'
  [100%] [100%] Building CXX object CMakeFiles/example1_b.dir/src/example1_b.cpp.o
  Building CXX object CMakeFiles/example1_a.dir/src/example1_a.cpp.o
  /home/rospc/dev/rosbook/chapter2_tutorials/src/example1_a.cpp: In function ‘int main(int, char**)’:
  /home/rospc/dev/rosbook/chapter2_tutorials/src/example1_a.cpp:8:42: error: ‘std_’ was not declared in this scope
   ros::Publisher chatter_pub = n.advertise&lt;std_
                                            ^
  /home/rospc/dev/rosbook/chapter2_tutorials/src/example1_a.cpp:8:32: error: parse error in template argument list
   ros::Publisher chatter_pub = n.advertise&lt;std_
                                  ^
  /home/rospc/dev/rosbook/chapter2_tutorials/src/example1_a.cpp:9:30: error: no matching function for call to ‘ros::NodeHandle::advertise(const char [8], int)’
   msgs::String&gt;("message", 1000);
                                ^
  /home/rospc/dev/rosbook/chapter2_tutorials/src/example1_a.cpp:9:30: note: candidates are:
  In file included from /opt/ros/indigo/include/ros/ros.h:45:0,
                   from /home/rospc/dev/rosbook/chapter2_tutorials/src/example1_a.cpp:1:
  /opt/ros/indigo/include/ros/node_handle.h:236:15: note: template&lt;class M&gt; ros::Publisher ros::NodeHandle::advertise(const string&amp;, uint32_t, bool)
       Publisher advertise(const std::string&amp; topic, uint32_t queue_size, bool latch = false)
                 ^
  /opt/ros/indigo/include/ros/node_handle.h:236:15: note:   template argument deduction/substitution failed:
  /home/rospc/dev/rosbook/chapter2_tutorials/src/example1_a.cpp:9:30: error: template argument 1 is invalid
   msgs::String&gt;("message", 1000);
                                ^
  In file included from /opt/ros/indigo/include/ros/ros.h:45:0,
                   from /home/rospc/dev/rosbook/chapter2_tutorials/src/example1_a.cpp:1:
  /opt/ros/indigo/include/ros/node_handle.h:302:13: note: template&lt;class M&gt; ros::Publisher ros::NodeHandle::advertise(const string&amp;, uint32_t, const SubscriberStatusCallback&amp;, const SubscriberStatusCallback&amp;, const VoidConstPtr&amp;, bool)
     Publisher advertise(const std::string&amp; topic, uint32_t queue_size,
               ^
  /opt/ros/indigo/include/ros/node_handle.h:302:13: note:   template argument deduction/substitution failed:
  /home/rospc/dev/rosbook/chapter2_tutorials/src/example1_a.cpp:9:30: error: template argument 1 is invalid
   msgs::String&gt;("message", 1000);
                                ^
  make[3]: *** [CMakeFiles/example1_a.dir/src/example1_a.cpp.o] Error 1
  make[3]: Leaving directory `/home/rospc/dev/rosbook/chapter2_tutorials/build'
  make[2]: *** [CMakeFiles/example1_a.dir/all] Error 2
  make[2]: *** Waiting for unfinished jobs....
  Linking CXX executable ../bin/example1_b
  make[3]: Leaving directory `/home/rospc/dev/rosbook/chapter2_tutorials/build'
  [100%] Built target example1_b
  make[2]: Leaving directory `/home/rospc/dev/rosbook/chapter2_tutorials/build'
  make[1]: *** [all] Error 2
  make[1]: Leaving directory `/home/rospc/dev/rosbook/chapter2_tutorials/build'
  make: *** [all] Error 2
  </code></pre>
  
  <p>This next code is from the second file, which does compile and creates no errors:</p>
  
  <pre><code>#include "ros/ros.h"
  #include "std_msgs/String.h"
  
  void chatterCallback(const std_msgs::String::ConstPtr&amp; msg)
  {
  ROS_INFO("I heard: [%s]", msg-&gt;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, chatterCallback);
  ros::spin();
  return 0;
  }
  </code></pre>