This may be a Visual Studio question more than anything else...
I\'m trying to build a 0MQ C++ example using VS10 and ZeroMQ 2.2.0.
I downloaded the windows sources and
You should add ZMQ_STATIC
to C/C++\Preprocessor\Preprocessor Definitions
in your "empty console project" too. Otherwise, when you compile your application, ZMQ_EXPORT
in zmq.h
is defined as __declspec(dllimport)
, and as a result, MSVC looks for __imp__zmq_*
symbols instead of zmq_*
Is the static linking very important to you? If not, you can try out the second answer by elnino_9 here. Elaborating elnino_9's answer:
Some comments:
publisher.bind("ipc://weather.ipc");
) will cause an exception. As explained here (though in fine-print), the Inter-Process Transport is not supported on Windows.EDIT
I think the answer to my first comment can be found in MSDN:
"When the source code for the calling executable is compiled or assembled, the DLL function call generates an external function reference in the object code. To resolve this external reference, the application must link with the import library (.lib file) provided by the maker of the DLL."
I had similar errors - not when trying to statically link, but just trying to create a ZMQ project and link the .lib 'stubs' for the dll.
In my case it was because I was trying to link the 64-bit libraries into a 32-bit project. I had downloaded the wrong version. When I got the right ones, ie x86 instead of x64, it worked.