[zeromq-dev] Problem porting to Windows

KIU Shueng Chuan nixchuan at gmail.com
Wed Mar 13 14:59:45 CET 2013


To link explicitly to the DLL, you would do the following:

gcc -I<include_path> -o broker.exe broker.c "C:\Program Files\ZeroMQ
3.2.2\bin\libzmq-v110-mt-gd-3_2_2.dll"

No -L required.
I don't normally try linking to MSVC compiled DLLs, so although the syntax
above is correct, I do not know if it will work.

gcc -I<include_path> -L<library_path> broker.c -o broker.exe -lzmq
will search for a file named libzmq.a or libzmq.dll.a in library_path. The
.lib files that you listed are not usable by MinGW.

It's simpler to just compile libzmq with MinGW itself.
There's a Makefile for mingw32 at:
https://github.com/zeromq/libzmq/tree/master/builds/mingw32
This Makefile does not require MSYS to be installed.
Just run "mingw32-make -f Makefile.mingw32"

It will create both libzmq.dll and its import library libzmq.dll.a
You will then be able to use the following syntax:

gcc -L. broker.c -o broker.exe -lzmq
(this will link to libzmq.dll.a in the current directory)
or
gcc broker.c -o broker.exe libzmq.dll



On Wed, Mar 13, 2013 at 8:52 PM, Alan Ward <alan.ward at btinternet.com> wrote:

> Hi,****
>
> Thanks for your reply. Making some progress now. I no longer get the
>  -lzmq .. not found message****
>
> ** **
>
> If I link to the ..\lib directory like this : ****
>
> ….. -L "C:\Program Files\ZeroMQ 3.2.2\lib" -oQV_EM_message_broker.exe
> -llibzmq-v110-mt-gd-3_2_2****
>
> ** **
>
> I get the undefined reference errors.****
>
> ** **
>
> If I link to the ..\bin directory like this: ****
>
> ** **
>
> … -L "C:\Program Files\ZeroMQ 3.2.2\bin" -oQV_EM_message_broker.exe
> -llibzmq-v110-mt-gd-3_2_2****
>
> ** **
>
> I get: … /libzmq-v110-mt-gd-3_2_2.dll: file not recognized: File format
> not recognized.****
>
> ** **
>
> If I use the explicit dll file name like this:****
>
> ** **
>
> …. -L"C:\Program Files\ZeroMQ 3.2.2\bin\libzmq-v110-mt-gd-3_2_2.dll"****
>
> ** **
>
> I again get undefined reference.****
>
> ** **
>
> I don’t understand the difference between the  various dlls (or library
> files) – so maybe that is the problem.****
>
> ** **
>
> The …\lib directory contains:****
>
> ** **
>
> 20/10/2012  14:15            10,912 libzmq-v100-mt-3_2_2.lib****
>
> 20/10/2012  14:14            11,084 libzmq-v100-mt-gd-3_2_2.lib****
>
> 20/10/2012  14:14         5,853,184 libzmq-v100-mt-gd-3_2_2.pdb****
>
> 20/10/2012  14:19            10,230 libzmq-v110-mt-3_2_2.lib****
>
> 20/10/2012  14:18            10,396 libzmq-v110-mt-gd-3_2_2.lib****
>
> 20/10/2012  14:18         7,213,056 libzmq-v110-mt-gd-3_2_2.pdb****
>
> 20/10/2012  14:15            10,514 libzmq-v90-mt-3_2_2.lib****
>
> 20/10/2012  14:14            10,680 libzmq-v90-mt-gd-3_2_2.lib****
>
> 20/10/2012  14:14         5,033,984 libzmq-v90-mt-gd-3_2_2.pdb****
>
> ** **
>
> The …\bin directory contains:****
>
> ** **
>
> 20/10/2012  14:15            10,752 inproc_lat.exe****
>
> 20/10/2012  14:15            10,752 inproc_thr.exe****
>
> 20/10/2012  14:15           503,808 libzmq-v100-mt-3_2_2.dll****
>
> 20/10/2012  14:14         1,715,200 libzmq-v100-mt-gd-3_2_2.dll****
>
> 20/10/2012  14:19           498,176 libzmq-v110-mt-3_2_2.dll****
>
> 20/10/2012  14:18         1,808,384 libzmq-v110-mt-gd-3_2_2.dll****
>
> 20/10/2012  14:15           525,312 libzmq-v90-mt-3_2_2.dll****
>
> 20/10/2012  14:14         1,744,896 libzmq-v90-mt-gd-3_2_2.dll****
>
> 20/10/2012  14:15             8,704 local_lat.exe****
>
> 20/10/2012  14:15             9,728 local_thr.exe****
>
> 06/11/2007  20:25               526 Microsoft.VC90.CRT.manifest****
>
> 06/11/2007  20:24           245,248 msvcm90.dll****
>
> 19/02/2011  22:51           608,080 msvcp100.dll****
>
> 06/11/2007  22:02           851,456 msvcp90.dll****
>
> 19/02/2011  00:52           829,264 msvcr100.dll****
>
> 06/11/2007  22:02           627,200 msvcr90.dll****
>
> 20/10/2012  14:15             9,728 remote_lat.exe****
>
> 20/10/2012  14:15             8,704 remote_thr.exe****
>
> ** **
>
> *From:* zeromq-dev-bounces at lists.zeromq.org [mailto:
> zeromq-dev-bounces at lists.zeromq.org] *On Behalf Of *KIU Shueng Chuan
> *Sent:* 13 March 2013 08:22
> *To:* ZeroMQ development list
> *Subject:* Re: [zeromq-dev] Problem porting to Windows****
>
> ** **
>
> If you specify -lzmq, mingw searches for libzmq.a or libzmq.dll.a. Are
> they present in your library directory?****
>
> Or you could just pass to GCC the path to the zmq DLL. Mingw accepts that
> in lieu of an import lib.****
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20130313/274e9284/attachment.htm>


More information about the zeromq-dev mailing list