在ubuntu下使用make编译的时候出现错误:
error: ‘boost::mutex’ has not been declared
以及:
error: ‘mutex’ in namespace ‘boost’ does not name a type
等错误,原因是有可能是没有安装boost或者是没有添加boost头文件:
排查方法,首先查看是否安装boost:
dpkg -S /usr/include/boost/version.hpp
返回结果是:
libboost1.71-dev:amd64: /usr/include/boost/version.hpp
证明是安装了boost了,附上安装boost的指令:
sudo apt-get install libboost-all-dev
若系统安装了boost,在报错的.pp文件文件中添加:
#include <boost/thread/mutex.hpp>
抱错消失,编译成功。