QMQTT undefined reference to ...
-
wrote on 18 Nov 2017, 22:51 last edited by
625/5000
I have a problem with the QMQTT library from https://github.com/toni1991/QtMqtt I'm trying my first with it but there's always this bug.
Error: undefined reference to `QMQTT :: Client :: Client (QString const &, unsigned int, QObject *) '
The library has 2 directories for source files and for header files.
in .pro I have specified these directories as INCLUDEPATH + = ...
I create a pointer object of a class from INCLUDEPATH, that works too.
As soon as I create the object with new wil this error comes.
It seems to me that QT does not find the .cpp files.Does anyone know why this is?
If someone has a solution I would be very grateful for that.
-
Hi,
Might be a silly question but are you linking your application against that module ?
-
wrote on 18 Nov 2017, 23:10 last edited by
How do you mean that?
This is the first time I want to use an external library.
It may well be that I did not do that. How should I do that? -
Link against the library generate by that project:
LIBS += -lqmqtt
.Just in case, if you'd like to remain with Qt's own framework, it now provides the QtMqtt module that you can use as any other Qt modules.
-
wrote on 18 Nov 2017, 23:36 last edited by
that with LIBS + = does not work.
I understand the context not synonymous if you just -qmqtt angiel, how knows QT what needs to be done with it? Is this a path or a file or is it something?Do you mean with QtMqtt what is described here? http://blog.qt.io/blog/2017/08/14/introducing-qtmqtt-protocol/
If so, I would be very happy, because I thought that it is not yet public.By the way, are you Swiss? =)
I'm swiss. -
Qt doesn't, the
LIBS
variable is where you give options to give to the linker.Did you build and install that project ? If so where did you install it ? You might need to give an additional path for the linker to find the library.
I already gave you the link to the official repository in my previous answer.
Yes I am.
-
wrote on 18 Nov 2017, 23:59 last edited by Alex-Krieg
-
wrote on 19 Nov 2017, 16:11 last edited by
@SGaist
How do I have to proceed to install the library from your link?
I have already downloaded the zip.
Where do I have to unzip it and how do I build it?
I work under Windows 8.1 and compile with MinGW. -
@SGaist
How do I have to proceed to install the library from your link?
I have already downloaded the zip.
Where do I have to unzip it and how do I build it?
I work under Windows 8.1 and compile with MinGW.@Alex-Krieg said in QMQTT undefined reference to ...:
@SGaist
How do I have to proceed to install the library from your link?If you mean QtMqtt, it does not matter where you install it.
make install
will copy headers, .lib and .dll to the correct position in your Qt tree.Afterwards you can add
QT += mqtt
(I guess) in your pro file and all should be fine automatically.For the other library however (if you want to use it), you need to specify the link path too:
LIBS += -L/path/to/lib -llibname-without-extension
-
wrote on 19 Nov 2017, 22:16 last edited by
@aha_1980
Thank you for this info but in my last Picture you can se, that I had an error during the "make" I realy downt know why. In my .pro is the "QT += qmqtt" but it says "Project ERROR: Unknown module(s) in QT: mqtt" -
Do I read the error correctly:
-std-c++1z
? That should be-std=c++1z
-
wrote on 19 Nov 2017, 22:21 last edited by
@SGaist its "-std=c++1z"
What can you say about this?
I really do not understand that anymore -
That enables C++17 support, did you trigger it somewhere ?
Otherwise, why not build it trough Qt Creator ? That will ensure that the build environment matches the Qt version you want to use directly.
-
wrote on 19 Nov 2017, 22:41 last edited by
-
@Alex-Krieg: Did you run
make install
after buildin QtMqtt? You can add it as build step aftermake
in the Projects settings un Creator. -
wrote on 20 Nov 2017, 05:30 last edited by
@aha_1980 rly? you are the best.
after the make install it worked. Thank you very much. I'm very happy about that now.
Thanks a lot. =)
1/16