[zeromq-dev] Qt C++ Windows

Eric Gendron conceptid at gmail.com
Tue Dec 13 16:41:01 CET 2016


Thanks for trying.

I have the same error: "cannot find -llibzmq_d" and if I remove the _d
part, same thing... cannot find -llibzmq

error: ld returned 1 exist status    collect2.exe


My .pro:

QT += core

QT -= gui


CONFIG += c++11


TARGET = hello

CONFIG += console

CONFIG -= app_bundle


TEMPLATE = app


INCLUDEPATH += C:/zmq/include

INCLUDEPATH += C:/zmq/src

INCLUDEPATH += C:/zmq/bin


CONFIG(debug, debug|release) {


    LIBS += -LC:/zmq/lib -llibzmq_d

}


CONFIG(release, debug|release) {


    LIBS += -LC:/zmq/lib -llibzmq

}


SOURCES += main.cpp \

    guid.cpp


HEADERS += \

    guid.h \



The folder with zmq install:

C:\zmq
with bin, doc, include, lib, src... subfolders.

I copied all the dll in c:\zmq\lib and I have:
I also copied all the dll in the debug folder where the app execute...

libzmq-v90-mt-4_0_4.lib (and .dll and .pdb)
libzmq-v90-mt-gd-4_0_4.lib
libzmq-v100-mt-gd_4_0_4.lib
etc... for v110 and v120




On Tue, Dec 13, 2016 at 5:22 AM, Stuart Dootson <stuart.dootson at gmail.com>
wrote:

> On 12 December 2016 at 16:08, Eric Gendron <conceptid at gmail.com> wrote:
>
>> Thanks for answer.  I have already that in my .pro
>>
>> INCLUDEPATH += C:/zmq/include
>>
>> INCLUDEPATH += C:/zmq/src
>>
>> INCLUDEPATH += C:/zmq/bin
>>
>>
>> win32: LIBS += -LC:/zmq/lib -lzmq
>>
>>
>> On Mon, Dec 12, 2016 at 10:16 AM, Stuart Dootson <
>> stuart.dootson at gmail.com> wrote:
>>
>>> On 12 December 2016 at 12:30, Eric Gendron <conceptid at gmail.com> wrote:
>>>
>>>> I used the windows install for 0mq.
>>>> I try to compile an hello world code...
>>>> I use Qt c++ with Qt creator and mingw compiler of course.
>>>>
>>>> I even tried recompile 0mq with the python script or something like
>>>> that on the site... and make give me errors.
>>>>
>>>> I do all in 32 bits to be sure.
>>>>
>>>> My laptop is windows 7 pro 64 bits.
>>>>
>>>> I can compile my code with clang++ in ubuntu linux or freebsd with
>>>> binary 0mq.
>>>>
>>>> I can compile in Qt creator in ubuntu with g++ too and binary for 0mq.
>>>>
>>>>
>>>> On Dec 12, 2016 7:21 AM, "Oleksii Zamiatin" <ozamiatin at mirantis.com>
>>>> wrote:
>>>>
>>>> Hi,
>>>> Which compiler do you use on Windows and how do you install zmq (build
>>>> from sources)?
>>>> For MSVC the name of the library will be zmq.lib so -lzmq extracted to
>>>> libzmq.a will point to non existent library.
>>>> -lzmq should work for MinGW, but I’d double check on pathes
>>>> configuration.
>>>>
>>>> > On Dec 12, 2016, at 14:14, Eric Gendron <conceptid at gmail.com> wrote:
>>>> >
>>>> >
>>>> > Hi
>>>> >
>>>> > I succeed to use 0mq in linux and freebsd with clang++
>>>> >
>>>> > Now I would like to compile the code in Qt C++ windows and I didn't
>>>> succeed to link with the 0mq library or even compile it.
>>>> >
>>>> > I would like to know how to do it.
>>>> >
>>>> > Qt can't find -lzmq in LIBS command in .pro file.
>>>> >
>>>> > I tried to install 0mq 4.2 binaries windows 32 bits and copy zmq.hpp
>>>> I found in git in the same folder than .h
>>>> >
>>>> > Also I have a message that zmq_msg_gets doesn't exist.
>>>> >
>>>> > Really not easy to make it work.
>>>> >
>>>> > Thanks.
>>>> >
>>>>
>>>>
>>> Eric - you're going to have to add some extra definitions in the pro
>>> file for building on win32 - basically, you'll need to tell qmake where to
>>> find the 0mq include and library paths. I'd use something like:
>>>
>>> win32 {
>>>
>>>    INCLUDEPATH += *<path to your 0mq's include directory>*
>>>
>>>    LIBS += -lzmq -L*<path to your 0mq's lib directory>*
>>>
>>> }
>>>
>>>
>>> These qmake variables are documented at http://doc.qt.io/qt-4.8/qma
>>> ke-variable-reference.html#includepath and http://doc.qt.io/qt-4.8/qm
>>> ake-variable-reference.html#libs respectively.
>>>
>>> Hope that helps
>>>
>>> Stuart Dootson
>>>
>>
> I've just had a look at this again - it seems that on Windows, you need to
> include the 'lib' prefix on the -l option. This means that (having a debug
> variant for 0mq, as I do), I use:
>
> CONFIG(debug, debug|release) {
>
>    LIBS += -L<path-on-my-computer>/zeromq/lib -llibzmq_d
>
> }
>
> CONFIG(release, debug|release) {
>
>    LIBS += -L<path-on-my-computer>/zeromq/lib -llibzmq
>
> }
>
>
> Stuart Dootson
>
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> https://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20161213/80f97b2f/attachment.htm>


More information about the zeromq-dev mailing list