zmq protobuf 通信

apt直接安装

# zmq protobuf 环境安装
apt-get update
apt-get upgrade
apt-get install vim g++ cmake libprotobuf-dev protobuf-compiler libzmq3-dev -y

源码编译

# protobuf源码编译
cd protobuf-3.20.2/
mkdir build-make
cd build-make
sudo cmake ./ ../cmake/
sudo make install
# 提示 include lib bin的位置, 取出来放到一起
# libzmq源码编译
mkdir build
cd build
cmake ..
make -j8
sudo make install

CMakeLists使用

源码编译与 sudo apt install libprotobuf-dev 使用方法有所不同

# CmakeLists.txt

# lib
link_directories(
  /usr/local/lib #add protobuf
)

# target
target_link_libraries(${PROJECT_NAME}_node
  protobuf
  -lpthread
)

而apt安装的需要这样

# CmakeLists.txt

# target
target_link_libraries(${PROJECT_NAME}_node
  -lprotobuf
  -lpthread
)
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容