9

我正在尝试编译 zmq.org(即 github.com/imatix/zguide.git)提供的 ZMQ C++ 源代码示例。我的操作系统是 xubuntu,我正确安装了 ZMQ 先决条件,即 libtool、autoconf、automake 和 uuid-dev 包。我也安装了 czmq。ZMQ 本身的编译和链接很好,并且库位于 /usr/local/bin 下。尽管如此,我还是遇到了编译错误。谷歌搜索没有多大帮助,我想知道是否有人知道这些错误的快速解决方案,它源于缺少的头文件 zmq.hpp。提前致谢。

   $./build all
   hwclient.cpp
   hwclient.cpp:6:19: fatal error: zmq.hpp: No such file or directory
   compilation terminated.
   hwserver.cpp
   hwserver.cpp:6:19: fatal error: zmq.hpp: No such file or directory
   compilation terminated.
   identity.cpp
   identity.cpp:7:19: fatal error: zmq.hpp: No such file or directory
   compilation terminated.
   lbbroker.cpp
   In file included from lbbroker.cpp:7:0:
   zhelpers.hpp:29:19: fatal error: zmq.hpp: No such file or directory
   compilation terminated.
   lpclient.cpp
   In file included from lpclient.cpp:6:0:
   zhelpers.hpp:29:19: fatal error: zmq.hpp: No such file or directory
   compilation terminated.
   lpserver.cpp
   In file included from lpserver.cpp:8:0:
   zhelpers.hpp:29:19: fatal error: zmq.hpp: No such file or directory
   compilation terminated.
   mdbroker.cpp
   In file included from zmsg.hpp:35:0,
             from mdbroker.cpp:7:
   zhelpers.hpp:29:19: fatal error: zmq.hpp: No such file or directory
   compilation terminated.
   mdclient.cpp

……

4

2 回答 2

11

看起来 zmq.hpp 已从 ZMQ 3.2 开始移动到另一个 git 存储库,该存储库可在https://github.com/zeromq/cppzmq获得。我已将其克隆到先前提取 ZMQ 的 tar 球的相同位置。然后我从示例的 C++ 目录创建了一个指向 zmq.hpp 的符号链接。然后示例编译得很好。

于 2013-01-09T12:20:40.933 回答
1
prem@~/Code/zeromq>ls
cppzmq-master.zip  zguide  zmqpp-develop  zmqpp-develop.zip
prem@~/Code/zeromq>unzip cppzmq-master.zip 
Archive:  cppzmq-master.zip
235803740753312576495301ebf5b8ed76407173
   creating: cppzmq-master/
  inflating: cppzmq-master/LICENSE   
  inflating: cppzmq-master/README    
  inflating: cppzmq-master/zmq.hpp   
prem@~/Code/zeromq>ls
cppzmq-master  cppzmq-master.zip  zguide  zmqpp-develop  zmqpp-develop.zip
prem@~/Code/zeromq>cd cppzmq-master/
prem@~/Code/zeromq/cppzmq-master>ls
prem@~/Code/zeromq/cppzmq-master>sudo cp zmq.hpp /usr/include/
prem@~/Code/zeromq/cppzmq-master>cd ~/Code/zeromq/zguide/examples/C++
prem@~/Code/zeromq/zguide/examples/C++>./build all
Building C++ examples...
hwclient.cpp
hwserver.cpp
identity.cpp
interrupt.cpp
...
prem@~/Code/zeromq/zguide/examples/C++>
于 2013-11-21T01:37:56.223 回答