I am currently doing a course on ROS in 5 days in C++. I am currently doing the services part. I am getting the following error alt text

I have created the CPP file and compiled it with modification in the CMakeLists file as well. I made sure that the compiled version of the file is found in the devel/lib/service_server_pkg directory. I'm posting the screenshot of both my IDE and the the location of the compiled file version for your reference.

alt text

Image of the directory of the compiled version of the file

alt text

Please let me know what I'm missing here.

asked 20 May, 15:37

eashwar.erahan's gravatar image

accept rate: 0%

Hi @eashwar.erahan,

You need to remove the string ".cpp" from your node name, in your launch file. The compiled file is saved without the .cpp extension, just as simple_service_server in this case.

For Python, you still use the full Python file name, including the .py extension, as the node name. But for C++, you use the file name without the .cpp extension. Interesting, isn't it? :D

permanent link
This answer is marked "community wiki".

answered 21 May, 10:47

bayodesegun%40bayodesegun.com's gravatar image

accept rate: 52%

edited 21 May, 10:49

oh ok I get it. I need to run the compiled version of the file rather than the .cpp file. Whereas in Python we dont compile the file , so we directly run the file, hence we include .py eextension. Why did I not think about it? :D

(21 May, 11:38) eashwar.erahan
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 20 May, 15:37

question was seen: 58 times

last updated: 21 May, 11:38

powered by OSQA