I\'ve been trying to properly add the open source dns_sd.h library provided by Apple. I am writing a program that uses the BonjourRegistrar class as demonstrated here: link
Try adding
DEFINES += _WIN32
to your project file.
I figured it out, you need to use reimp and dll tool to modify the lib library to a .a
The .lib distributed by Apple can be used only if you are compiling the Qt application with the MSVC compiler.
Otherwise, like you said, you need a GCC-compatible library (.a). To do that you need to do the following steps:
reimp dnssd.lib
. A file DLLStub.obj
will be generated.gendef dnssd.dll
. A file dnssd.def
will be generated. The .dll can be obtained from: C:\Windows\System32
if you are using the 32 bit or from C:\Windows\SysWOW64
for the 64 bit version.dlltool -k -d dnssd.def -l libdnssd.a
.LIBS += -L"/path/to/the/library/file" -ldnssd
[0] - http://sourceforge.net/projects/mingw/files/MinGW/Extension/mingw-utils/mingw-utils-0.4-1/
[1] - http://sourceforge.net/projects/mingw/files/MinGW/Extension/gendef/gendef-1.0.1346/ - gendef is a better alternative to pexports
, because it can convert the stdcall-type libraries from MSVC to the GCC ones, so you can get a proper .def file.
PS: I know the author got it working, but I felt there should be some more detailed instructions on how to get it done -- the information is scattered around the internet.