ubuntu 配置muduo库

依赖库安装

  • sudo apt-get install cmake
  • sudo apt-get install libboostxxx-dev (将xxx替换为数字)方法:先输入 sudo apt-get install libboost-dev,系统会提示依赖哪个版本。  

  • sudo apt-get install libboost1.65-dev

  • sudo apt-get install libcurl4-openssl-dev

  • sudo apt-get install libc-ares-dev (注意此处不是linc-ares-dev)
  • sudo apt-get install protobuf-compiler

  • sudo apt-get install libprotobuf-dev

安装:muduo的编译(release版本)

./build.sh -j2 //编译库和它自带的例子,生成可执行文件和静态库文件,分别位于../buidl/release/{bin,lib}
编译需要g++/gcc

  • 安装gcc/g++:
sudo apt-get install build-essential
报错:

解决方法:
sudo add-apt-repository ppa:jonathonf/gcc
sudo apt-get update
(如果还不可以添加:
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update)

 add-apt-repository 安装:

sudo apt-get install software-properties-common
sudo apt-get update

./build.sh install //将头文件和静态库文件安装到../build/release-install/{include,lib} 

库的使用:

 

 








原文地址:https://www.cnblogs.com/GuoXinxin/p/11231781.html