Score:0

add_executable Error - CMake

sd flag

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.

hr flag
This sounds like an question about `cmake` and/or programming - rather than about Ubuntu. It would probably be more appropriate on [so]
Score:0
ph flag

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.

mfatih avatar
sd flag
Yes you are right. The instructions are not clear. Thanks for your answer.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.