Ask Your Question
0

Error : required from here

asked 2013-03-26 05:20:20 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

Hi everyone,

I have problem in eclipse program. I used simplest code for publisher and I get on this problem: required from here by this statement (line 38):

  output_modem_publisher_.publish(m2);

The code is :

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

#include <sstream>


int main(int argc, char** argv)
{
  ros::init(argc, argv, "test");
  ros::NodeHandle nh;
    ros::Publisher output_modem_publisher_;
    const std::string modem_topic_ = "monsun/modem/in";
    output_modem_publisher_ = nh.advertise<std_msgs::String>(modem_topic_, 1000);


  ros::Rate loop_rate(15);

  int count = 0;

  while (ros::ok())
  {

        std::string out_modem2;
        std::stringstream monsun2;

        monsun2 << 2 << "Ammar" ;
        out_modem2 = monsun2.str();
        std_msgs::String m2;
        m2.data = out_modem2;
        output_modem_publisher_.publish(m2);
        ROS_INFO("m2222222222 ");

    ros::spinOnce();
    loop_rate.sleep();

    ++count;
  }

  return 0;
}

And the output of build project is:

16:12:09 * Incremental Build of project modem_test-RelWithDebInfo@modem_test * /usr/bin/make -j8 all mkdir -p bin cd build && cmake -Wdev -DCMAKE_TOOLCHAIN_FILE=/opt/ros/groovy/share/ros/core/rosbuild/rostoolchain.cmake .. Re-run cmake no build system arguments [rosbuild] Building package modem_test -- Using CATKIN_DEVEL_PREFIX: /home/amory/ros_workspace/modem_test/build/devel -- Using CMAKE_PREFIX_PATH: /opt/ros/groovy -- This workspace overlays: /opt/ros/groovy -- Found gtest sources under '/usr/src/gtest': gtests will be built -- catkin 0.5.63 [rosbuild] Including /opt/ros/groovy/share/roscpp/rosbuild/roscpp.cmake [rosbuild] Including /opt/ros/groovy/share/rospy/rosbuild/rospy.cmake -- Configuring done -- Generating done CMake Warning: Manually-specified variables were not used by the project:

CMAKE_TOOLCHAIN_FILE

-- Build files have been written to: /home/amory/ros_workspace/modem_test/build cd build && /usr/bin/make make[1]: Entering directory /home/amory/ros_workspace/modem_test/build' /usr/bin/cmake -H/home/amory/ros_workspace/modem_test -B/home/amory/ros_workspace/modem_test/build --check-build-system CMakeFiles/Makefile.cmake 0 /usr/bin/cmake -E cmake_progress_start /home/amory/ros_workspace/modem_test/build/CMakeFiles /home/amory/ros_workspace/modem_test/build/CMakeFiles/progress.marks /usr/bin/make -f CMakeFiles/Makefile2 all make[2]: Entering directory/home/amory/ros_workspace/modem_test/build' /usr/bin/make -f CMakeFiles/rospack_genmsg_libexe.dir/build.make CMakeFiles/rospack_genmsg_libexe.dir/depend make[3]: Entering directory /home/amory/ros_workspace/modem_test/build' cd /home/amory/ros_workspace/modem_test/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/amory/ros_workspace/modem_test /home/amory/ros_workspace/modem_test /home/amory/ros_workspace/modem_test/build /home/amory/ros_workspace/modem_test/build /home/amory/ros_workspace/modem_test/build/CMakeFiles/rospack_genmsg_libexe.dir/DependInfo.cmake --color= make[3]: Leaving directory/home/amory/ros_workspace/modem_test/build' /usr/bin/make -f CMakeFiles/rospack_genmsg_libexe.dir/build.make CMakeFiles/rospack_genmsg_libexe.dir/build make[3]: Entering directory /home/amory/ros_workspace/modem_test/build' make[3]: Nothing to be done forCMakeFiles/rospack_genmsg_libexe.dir/build'. make[3]: Leaving directory /home/amory/ros_workspace/modem_test/build' /usr/bin/cmake -E cmake_progress_report /home/amory/ros_workspace/modem_test/build/CMakeFiles [ 0%] Built target rospack_genmsg_libexe /usr/bin/make -f CMakeFiles/rosbuild_precompile.dir/build.make CMakeFiles/rosbuild_precompile.dir/depend make[3]: Entering directory/home/amory/ros_workspace/modem_test/build' cd /home/amory/ros_workspace/modem_test/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/amory/ros_workspace/modem_test /home/amory/ros_workspace/modem_test /home/amory/ros_workspace/modem_test/build /home/amory/ros_workspace/modem_test/build /home/amory/ros_workspace/modem_test/build/CMakeFiles ... (more)

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2013-03-27 05:31:58 -0600

There is probably a bug in Eclipse output parser. If your code compiles and there is no errors on console output of Eclipse then you are fine.

I usually have same 'errors' on publish() functions, but it is harmless. It is a bit annoying though that Eclipse highlights these lines as erroneous.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2013-03-26 05:20:20 -0600

Seen: 1,809 times

Last updated: Mar 27 '13