Installing Boost on Ubuntu 安装

Installing Boost on Ubuntu 安装

标签(空格分隔): linux

Boost是非常简洁,强大的C++标准库。

安装 libboost-all-dev and aptitude

sudo apt-get install libboost-all-dev
sudo apt-get install aptitude
aptitude search boost

应该能得到类似:
p libboost1.55-tools-dev - Boost C++ Libraries development tools
p libboost1.55-tools-dev:i386 - Boost C++ Libraries development tools
的结果。

检查并测试一下

  1. Then paste this into a C++ file called main.cpp:
#include <iostream>
#include <boost/array.hpp>
using namespace std;
int main(){
  boost::array<int, 4> arr = {{1,2,3,4}};
  cout << "hi" << arr[0]<<endl;
  return 0;
}
  1. Compile like this:
g++ -o s main.cpp
  1. Run it like this:
./s

应该能得到输出:

hi1

你可能感兴趣的:(linux)