Closed ghost closed 4 years ago
Re versioning: The zmq_version
is that of libzmq
. Since it can be a dynamic library, it's useful to query this at compile time. The version of cppzmq is only made available via compile-time macros, as it is a header-only library. The versions do not correspond.
Re the syntax error: Unfortunately, the compiler messages are not complete, so it's not easy to tell where they come from. When using Visual Studio, it's better to copy the compiler output than the error list. But I suspect that zmq::message_t(0)
is the problem. I am not sure what this ought to mean? But it's also unclear what type REQUEST_fmi2DoStep
has.
I was able to compile by code by commenting out the following block in zmq.hpp:
/*
template<class ForwardIter> message_t(ForwardIter first, ForwardIter last)
{
typedef typename std::iterator_traits<ForwardIter>::value_type value_t;
assert(std::distance(first, last) >= 0);
size_t const size_ =
static_cast<size_t>(std::distance(first, last)) * sizeof(value_t);
int const rc = zmq_msg_init_size(&msg, size_);
if (rc != 0)
throw error_t();
std::copy(first, last, data<value_t>());
}
*/
My code also compiles if I remove the "zmq::message_t(0)", for some reason I found some example code and just tried to use that as-is. Thank you for your fast reply!
Trying to compile Visual Studio 2019 into a .dll, containing cppzmq and libzmq.
Build succeeds with only libzmq, with code like:
Output: Current 0MQ version is 4.3.3
Installed libzmq and cppzmq like this:
Building by just including the headers works, but including some code does not:
Code added:
Error during build:
I'm not sure why libzmq shows 4.3.3 when running my app, but cppzmq states version 4.6.0 in vcpkg - I assume they are developed at entirely different paces and that 4.6.0 of cppzmq should be compatible with 4.3.3 of libzmq. Am I missing something obvious? I undertand all I need is the headers and a working libzmq, since "cppzmq is a light-weight, header-only binding. You only need to include the header file zmq.hpp (and maybe zmq_addon.hpp) to use it."
Any help is greatly appreciated!