Robotics StackExchange | Archived questions

I can't add a library to my workspace. Can someone help me out, please?

Hello all, my problem seems very easy but I can't handle for 2 days. I just want to add a library to my program. The library's name is asio. What I want to do is exactly shown in this video( https://www.youtube.com/watch?v=2hNdkYInj4g&t=319s&ab_channel=javidx9 ) (ONLY time between 2:30~5:20)

What I did so far? I downloaded the zip file of asio library like said in the video and unzip it. Then I copy the include folder that is in the folder that I just unzip to usr/include/serhat folder.(serhat folder is a just empty folder to store this library) Then I include all .hpp files to my programs. After including header files, I can use benefits this library and even my IDE start showing shortcuts of the objects related to this library. But then I made catkin_make and I got some fatal errors written below:

/home/serhatsony/catkin_ws/src/using_markers/src/tcp_learning_04.cpp:41:30: fatal error: asio/awaitable.hpp: No such file or directory
compilation terminated.

How should I solve this problem? I am open for all kind of answers. How can I do what the guy did in this video on my Ros/Linux?

UBUNTU 16.04 - Kinetic - Ros1. I use Visual Studio as IDE.

Thank You!

Asked by serhat on 2021-01-27 08:45:08 UTC

Comments

What package are you trying to build using catkin_make? Did you copy the above file to the package you are trying to build?

Asked by skpro19 on 2021-01-28 01:53:15 UTC

Hello Shubham, thank you for your comment firstly. I downloaded the asio library. And it includes a lot files inside itself. I don't know which one I should include? In the video I mentioned, the guy links to "include" file in the asio library to directly his SDK. This library is actually header based so I should add this library by typing "#include " in my program. But of course I should indicate where the asio library that I downloaded is properly in my laptop. So, I copy to asio library to my usr/include file, thus I'd be able to use this library with normal condition. Isn't it? I guess there is something needed I need to do in CMakeList.txt or package.xml file. If you can suggest me a tutorial about that, I am very open. Thank you again.

Asked by serhat on 2021-01-29 01:48:39 UTC

Answers

Hi all again, I solved my problem and wanted to add the solution here as well. In shortly, I downloaded asio library as standalone and unzip it. I created a directory called "asio" in my usr/include directory. After unzipping the library, I copy these files(asio-1.18.1/include/asio and asio-1.18.1/include/asio.hpp) to my usr/include/asio directory which I just created by myself. Since asio library is based on header files, I am able to use benefits of asio library now by just adding these includes:

#include <asio/asio.hpp> 
#include <asio/ts/buffer.hpp>
#include <asio/ts/internet.hpp>

I don't get any compiler error now. As you can see in my solution, I did not change anything in my CMakeList.txt or package.xml files. This is how I solved my problem. I hope that it works for you too.

Asked by serhat on 2021-02-01 01:17:53 UTC

Comments

hi @serhat can you please share you solution by stepwise.. Thanks in advance

Asked by Sam123 on 2022-02-15 13:24:58 UTC

Hi @Shoukat.M, my solution is defined above actually, there is no addition step besides those I typed. Which particular step did you get stuck in?

Asked by serhat on 2022-02-16 03:10:27 UTC

hi @serhat it works, thank you !!!

Asked by ahmetalperenvar on 2023-03-21 09:24:08 UTC