This article is tested against following version / configuration:
- Visual Studio 2012 (V110) Platform Toolset
- Win32
- ZeroMQ 4.0.4
- Runtime Library: Multi-threaded DLL (/MD)
Steps to setup ZeroMQ on a Visual Studio C++ project:
- Download and install ZeroMQ-4.0.4~miru1.0-x86.exe (or newer) from http://zeromq.org/distro:microsoft-windows
- Set ZEROMQ_HOME environment variable to C:\Program Files (x86)\ZeroMQ 4.0.4 (or wherever you installed it to)
- On Visual Studio project configuration, add $(ZEROMQ_HOME)\include to Configuration Properties -> VC++ Directories. Don’t forget to restart Visual Studio so it picks up the new environment variable
- Add $(ZEROMQ_HOME)\lib to Linker -> General -> Additional Library Directories
- Add libzmq-v110-mt-4_0_4.lib to Linker -> Input -> Additional Dependencies
- Get a copy of zmq.hpp from , place this somewhere on your project. This header file references zmq.h located at $(ZEROMQ_HOME)\include
- Once you’ve compiled your executable, place libzmq-v110-mt-4_0_4.dll on the same folder, otherwise ZeroMQ initialisation will cause runtime crash
And finally take a look at some excellent tutorial examples from zeromq.org website to get you started, in particular:
- Ask And Ye Shall Receive: Request – Reply pattern example
- Getting the Message Out: Publisher – Subscriber pattern example