Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

不能和ZeroMQ库同时使用 #322

Open
Z-eddy opened this issue May 9, 2023 · 1 comment
Open

不能和ZeroMQ库同时使用 #322

Z-eddy opened this issue May 9, 2023 · 1 comment

Comments

@Z-eddy
Copy link

Z-eddy commented May 9, 2023

测试环境:
平台:win10
ide:vs2022
ZeroMQ版本:4.3.4(当前最新版)
coost版本:v3.0.0/master

测试问题:
1、头文件必须如下顺序定义:
#include "co/all.h" #include "zmq.hpp"
如果颠倒位置则报错:
co\byte_order.h(37): error C3861: “htonll”: 找不到标识符

2、遵守第一点时通过编译,运行时会报错
测试代码:
`
#include

#include "co/all.h"
#include "zmq.hpp"

int main(int argc, char **argv) {
co::WaitGroup w{};
w.add(1);

go([&] {
std::string request{"hello"};

zmq::context_t context(1);
// 初始化socket,这行加入就会报错
zmq::socket_t socket(context, zmq::socket_type::req);
socket.connect("tcp://127.0.0.1:5555");
w.done();

});

w.wait();

return 0;
}

`
报错如下:
image

@idealvin
Copy link
Owner

idealvin commented May 9, 2023

1、头文件必须如下顺序定义:
#include "co/all.h" #include "zmq.hpp"
如果颠倒位置则报错:
co\byte_order.h(37): error C3861: “htonll”: 找不到标识符

这个可能是 winsock 版本冲突,先 include coost 头文件,使用 winsock2 应该能解决冲突。

第2个问题需要提供进一步的信息,使用 master 最新代码试试

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants