尝试编译时 ZMQ 的 poller.ipp 中出现错误

Error in ZMQ's poller.ipp when trying to compile

本文关键字:ipp 错误 poller 编译 ZMQ      更新时间:2023-10-16

尝试编译我的C 项目时,编译器在ZMQ的Poller.ipp中带有错误的编译器退出。我在做错什么吗,我需要其他编译器标志或其他内容吗?

我已经使用brew install czmqpp

安装了C 绑定(CZMQP )

系统:Mac OSX 10.11.5

这是我尝试使用以下命令进行编译时的输出:

> gcc -Wall -o HardwareHub HardwareHub.cpp
In file included from HardwareHub.cpp:4:
In file included from ./ZMQCommunicator.h:3:
In file included from /usr/local/include/czmq++/czmqpp.hpp:28:
In file included from /usr/local/include/czmq++/poller.hpp:48:
/usr/local/include/czmq++/impl/poller.ipp:29:19: error: expected expression
    auto unmask = [](socket& s)
                  ^
1 error generated.

预先感谢您

您需要使用C 编译器,而不是C编译器:

> gcc -Wall -o HardwareHub HardwareHub.cpp

应该是

> g++ -Wall -o HardwareHub HardwareHub.cpp

如果您当前安装的GCC版本不支持当前C 标准使用

> g++ -std=c++11 -Wall -o HardwareHub HardwareHub.cpp