Building czmq on MSVC

CZMQ, the high level C binding for ØMQ, is available for download from the official page, currently in version 1.1.0. The problem is that, if you want to use it for Visual Studio, there are a few issues.

Firstly, the zip file currently available misses some stuff, most notably, the solution files for MSVC. You can overcome this, getting the latest czmq version from github:
git clone git://

Next step is compiling it, and, as one should expect, the czmq source code includes references to zeromq. You can get it from here:
git clone git://

Now you are ready to open the czmq solution in the win32 subfolder. Ensure in the project - properties that the relation to zeromq is carried on correctly.

Compile it. If no changes occurred from when I have written this post, compiling for MSVC2010 you should get a few errors:
1>..\src\zframe.c(461): error C2440: 'initializing' : cannot convert from 'void *' to 'char *'
1>..\src\zmsg.c(194): error C2440: 'initializing' : cannot convert from 'void *' to 'zframe_t *'
1>..\src\zmsg.c(503): error C2440: '=' : cannot convert from 'void *' to 'byte *'
1>..\src\zmsg.c(772): error C2440: 'initializing' : cannot convert from 'void *' to 'byte *'
1>..\src\zsockopt.c(138): error C2440: 'initializing' : cannot convert from 'void *' to 'char *'
Explicit cast are required, patch the code like this:
// zframe.c:461
char *buffer = static_cast<char*>(malloc(1024));

// zmsg.c:194
zframe_t *frame = static_cast<zframe_t *>(zlist_pop (self->frames));

// zmsg.c:503
*buffer = static_cast<byte *>(malloc (buffer_size));

// zmsg.c:772
byte *blank = static_cast<byte *>(zmalloc (100000));

// zsockopt.c:138
char *identity = static_cast<char*>(zmalloc (option_len));
Once corrected these errors, you should complete correctly the czmq project, producing czmq.lib in the win32 folder.

Create a project that uses zmq and czmq, setting properly include and library directories, and a reference to the actual lib files among the linker additional dependencies.

Finally you can write a first tiny hello czmq application that just instantiate and destroy a zmq context:
#include <czmq.h>

// ...
    zctx_t* ctx = zctx_new();
    assert(ctx == NULL);


  1. based on your input ,i have created step by step instructions for setting up ZeroMQ+czmq playground here

    1. And you are referring to newer version of MSVC and ZeroMQ (this post was current for 2012 stuff). Thank you for sharing.