I'm using Raspberry Pi 3B+. I'm trying to compile a rather massive C++ package given to me from somewhere else. However make fails compiling. It cannot find boost/asio.hpp. I simplified the problem into this minimal version. This is my helloboost.c

#include <memory>
#include <string>
#include <vector>
#include <utility>
#include <boost/asio.hpp>

int main() {
  printf("hello boost\n");

If I comment out the #include <boost/asio.hpp> line it compiles with g++ helloboost.c just fine and works, but with this version the following error appears:

pi@raspberrypi:~/Documents/tmp_tests $ g++ helloboost.c 
helloboost.c:5:26: fatal error: boost/asio.hpp: No such file or directory
 #include <boost/asio.hpp>
compilation terminated.

Apparently it does find the other include files. Here is a similar question but it has not been answered. A comment there suggests making it a "SSCCE", I don't know what that means. Any help is appreciated.

  • You need to install the boost headers.
    – RalfFriedl
    Jun 26, 2019 at 17:52
  • @RalfFriedl how do I install them? sudo apt-get install boost does not work. Jun 26, 2019 at 17:58
  • It depends on the distribution, they should be named something like boost-devel or libboost-dev.
    – RalfFriedl
    Jun 26, 2019 at 18:03
  • @RalfFriedl that's right, I installed libboost-dev and it worked, thank you! Please make this into an answer so I can mark it as the correct one. Jun 26, 2019 at 18:12
  • Does this answer your question? Where to get Bluetooth/Bluetooth.h for Raspberry Pi? Dec 14, 2020 at 12:07

2 Answers 2


You have to install the headers for the boost libraries.

For most libraries, there are the runtime packages and the development packages. The runtime packages are needed to execute the programs and for development, the development packages are needed only for development. Usually the development packages have a -devel or -dev suffix.

For the boost library, install libboost-dev.


Another alternative that I have used is to install the standalone non-boost version via

apt-get install libasio-dev

The last I checked there was still a somewhat inadvertent dependency on one of the boost libraries anyway, but perhaps that has been resolved by now or it may be that the portions of asio that you need are unaffected. I found this to be a useful approach since many of the features of boost have already found their way into the C++ standard and into gcc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.