linux muduo compiler

muduo install and use

安装的话可以百度搜索一下:muduo网络库使用手册
这里进行一些简要的总结
先贴一下muduo库github地址:

https://github.com/chenshuo/muduo/

1.muduo采用CMake编译,首先安装CMake:

$ sudo apt-get install cmake
  • 1

2.muduo依赖boost库:

$ sudo apt-get install libboostxxx-dev
  • 1

3.muduo有三个非必须的依赖库,curl、c-ares DNS、google protobuf,如果安装了这三个库,cmake会多编译一些示例:

$ sudo apt-get install libcurl4-openssl-dev linc-ares-dev
$ sudo apt-get install protobuf-compiler libprotobuf-dev
  • 1
  • 2

muduo的编译(release版本):

./build.sh -j2  //编译库和它自带的例子,生成可执行文件和静态库文件,分别位于../buidl/release/{bin,lib}
./build.sh install //将头文件和静态库文件安装到../build/release-install/{include,lib}
  • 1
  • 2

编译完成后可运行其例子:bin/inspector_test,然后通过浏览器访问
http://xxx.xxx.xxx.xxx:12345/.其中,xxx.xxx.xxx.xxx为你的linuxIP
如何在自己项目中使用muduo:
muduo是静态链接的c++程序库,使用muduo库的时候,需要设置好头文件路径(例如../build/release-install/include)和库文件路径(例如../build/release-install/lib)并在编译时链接相应的静态库文件(-lmuduo_net -lmuduo_base)即可。
相应的示例Makefile地址:

https://github.com/chenshuo/muduo-tutorial


compiling problems

1\

CMake错误No CMAKE_CXX_COMPILER could be found.

Tell CMake where to find the compiler by setting either the environment

variable “CXX” or the CMake cache entry CMAKE_CXX_COMPILER to the full path

to the compiler, or to the compiler name if it is in the PATH.

sudo apt-get update
sudo apt-get install -y build-essential





  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值