Exercise 2.5 CMake error

I created the custom message following the instructions, however, when I try to compile the packages, CMake throws an error. Here’s the error message:

CMake Error at topic_subscriber_pkg/CMakeLists.txt:164 (add_dependencies):
  The dependency target "topic_subscriber_pkg_generate_message_cpp" of target
  "publish_age" does not exist.


-- Generating done
-- Build files have been written to: /home/user/catkin_ws/build
Makefile:766: recipe for target 'cmake_check_build_system' failed
make: *** [cmake_check_build_system] Error 1
Invoking "make cmake_check_build_system" failed

This error is caused by the CMakeLists.txt file due to the line (the message is located in the topic_subscriber_pkg)

add_dependencies(publish_age topic_subscriber_pkg_generate_messages_cpp)

If I remove the line, the package compiles but when I try rostopic echo /age_info, the following message shows up:

the rosdep view is empty: call 'sudo rosdep init' and 'rosdep update'
ERROR: Cannot load message class for [topic_subscriber_pkg/Age]. Are your messages built?

Hello @pranav.rambhia,

Did you manage to solve this issue? I had a look at your files but couldn’t find the ** topic_subscriber_pkg** package in order to reproduce the issue.

Best,