Module not found error while importing custom messages

Hi,

I am trying to do Exercise 5.3. building custom service message. After building the package I am able to see message and package listed in ros. But I get error while importing package.

After building your package with the newly defined srv message, have you done a source of the catkin_ws ? This is required for the system to recognize your newly built messages

cd ~/catkin_ws
source devel/setup.bash

yes I did run source. I am also able to see package using rospack list and service message using rossrv list. but when running this program it is giving error.
I also thought of cleaning the catkin workspace but getting this error

user:~/catkin_ws$ catkin clean
[clean] Error: The current or desired workspace could not be determined. Please run `catkin clean` from within a catkin workspace or specify the workspace explicitly with the `--workspace` option.

Cleaning the build and devel folder in catkin workspace worked.
rm -rf /build /devel

2 Likes