add_executable Error - CMake

I created a package and source file in my Ubuntu 20.04 computer. My goal is to visualize dummy sensors and objects in Rviz2. To do that I followed the How to visualize sensor data in ROS2 article. And, when I went to build the package with the command:

colcon build --symlink-install

I got this error:

Error

The cmake file I used is the following:

C Make Fİle

I am using ROS2 foxy distro.

1

1 Answer

When you have an add_executable command in cmake, it expects the files you list to exist relative to the location of your CMakeLists.txt file. So, for example, your workspace might look something like this:

.
└── my_package ├── CMakeLists.txt ├── include │   └── my_package ├── package.xml └── src └── dolly_follow.cpp

It looks like the tutorial you're following just copy & pasted a CMakeLists.txt from the dolly repository, but did not instruct you to actually pull any code from the repository; I would say the problem here is that the tutorial's instructions are unclear.

If you don't intend to actually compile a C++ file named dolly_follow.cpp, you can both remove the add_executable command that refers to it and the later install command that references the add_executable command's target.

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like