Libboost-pro trong linux

I'm on Ubuntu, and I want to install Boost. I tried with

sudo apt-get install boost

But there was no such package. What is the best way to install Boost on Ubuntu?

asked Sep 25, 2012 at 7:52

0

You can use apt-get command [requires sudo]

sudo apt-get install libboost-all-dev

Or you can call

aptitude search boost

find packages you need and install them using the apt-get command.

answered Sep 25, 2012 at 7:57

Anton GuryanovAnton Guryanov

11.5k1 gold badge14 silver badges16 bronze badges

12

Get the version of Boost that you require. This is for 1.55 but feel free to change or manually download yourself:

wget -O boost_1_55_0.tar.gz //sourceforge.net/projects/boost/files/boost/1.55.0/boost_1_55_0.tar.gz/download
tar xzvf boost_1_55_0.tar.gz
cd boost_1_55_0/

Get the required libraries, main ones are icu for boost::regex support:

sudo apt-get update
sudo apt-get install build-essential g++ python-dev autotools-dev libicu-dev libbz2-dev libboost-all-dev

Boost's bootstrap setup:

./bootstrap.sh --prefix=/usr/

Then build it with:

./b2

and eventually install it:

sudo ./b2 install

SAMPro

1,0441 gold badge18 silver badges38 bronze badges

answered Jun 6, 2014 at 16:14

user3715812user3715812

2,4351 gold badge10 silver badges2 bronze badges

12

Installing Boost on Ubuntu with an example of using boost::array:

Install libboost-all-dev and aptitude:

sudo apt install libboost-all-dev

sudo apt install aptitude

aptitude search boost

Then paste this into a C++ file called main.cpp:

#include 
#include 

using namespace std;
int main[]{
  boost::array arr = {{1,2,3,4}};
  cout > /etc/ld.so.conf.d/local.conf'

Reset the ldconfig:

sudo ldconfig

Coronon

3224 silver badges12 bronze badges

answered Dec 21, 2016 at 22:13

6

An update for Windows 10 Ubuntu Application via Subsystem [also works on standard Ubuntu]:

You might have problems finding the package. If you do, never fear! PPA is here!

sudo add-apt-repository ppa:boost-latest/ppa
sudo apt-get update

Then run:

sudo apt-get install libboost-all-dev

answered Jun 14, 2018 at 21:49

6

You can install boost on ubuntu by using the following commands:

sudo apt update

sudo apt install libboost-all-dev

answered Nov 1, 2020 at 11:37

First try the following:

$ sudo apt-get install libboost*

You may get an error message similar to the following, like I did:

E: Unable to correct problems, you have held broken packages.

Then try install below package:

$ sudo apt-get install libboost-all-dev

Now you can create a a sample project utilizing Boost:

$ mkdir boost
$ cd boost/
$ cat > main.cpp &

answered Sep 6, 2021 at 21:10

Actually you don't need "install" or "compile" anything before using Boost in your project. You can just download and extract the Boost library to any location on your machine, which is usually like /usr/local/.

When you compile your code, you can just indicate the compiler where to find the libraries by -I. For example, g++ -I /usr/local/boost_1_59_0 xxx.hpp.

answered Nov 23, 2015 at 2:56

3

Install libboost-all-dev by entering the following commands in the terminal

Step 1

Update package repositories and get latest package information.

sudo apt update -y

Step 2

Install the packages and dependencies with -y flag .

sudo apt install -y libboost-all-dev

Now that you have your libboost-all-dev installed source: //linuxtutorial.me/ubuntu/focal/libboost-all-dev/

answered Sep 14, 2020 at 14:59

Bài Viết Liên Quan

Chủ Đề