Unsolved QMQTT undefined reference to ...
-
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?
Error:
Directory:
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 ?
-
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.
-
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.
-
Yes I have build the library.
Location is where I have my QT projects.
From there with the CMD I have processed the following commands:
qmake
make
make install
Where are the libraries of QT installed?
I downloaded the library from your link and ran the same commands but there were errors. -
@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
-
@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
-
@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.
-
Ok mit Qt-Creater hat es funktioniert.
Die Dlls und so wurden erzeugt.
Jetzt habe ich im Projekt auf diese Verzeichnisse verwiesen aber da kommt immer der Error: "Project ERROR: Unknown module(s) in QT: mqtt"
Habe ich was falsch gemacht? -
@Alex-Krieg: Did you run
make install
after buildin QtMqtt? You can add it as build step aftermake
in the Projects settings un Creator. -
@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. =)