Comments (12)
@janoshh I guess your command is lacking the library path (-L) for the Paho MQTT C++ (-lmqttpp). You check the @prateekbansal comment above. But adding the path to libmqttpp.
from paho.mqtt.cpp.
The raw Makefiles now have a "make install" and the CMake/autotools deal with this properly.
from paho.mqtt.cpp.
Same here.
from paho.mqtt.cpp.
Hi Jason,
I faced the same issues. The first problem is the lack of "make install" to copy the paho-mqtt-cpp library to one of the standard paths. The second one is the handling of the dependencies. The paho-mqtt-c (C library).
Then, I started to work on two building system versions for this library, one is Autotools and the other is CMake. Those building systems address both of those problems.
The Autotools checks the existence of the libpaho-mqtta.so (the asynchronous version of the Paho C). Besides, it's possible to conditionally compile a static library version (passing --enable-static to configure), the documentation (--enable-doc) and the sample applications (--enable-samples).
$ git clone https://github.com/guilhermeferreira/paho.mqtt.cpp.git
$ git checkout -t origin/build-autotools
$ ./bootstrap
$ ./configure [options]
$ make
The CMake building system for Paho C++ was modeled after the one Rainer Poisel made to Paho C. To configure, use the "ccmake .." command inside the "build" directory. You have similar options as those for Autotools.
$ git clone https://github.com/guilhermeferreira/paho.mqtt.cpp.git
$ cd paho.mqtt.cpp
$ git checkout -t origin/build-cmake
$ mkdir build
$ cd build
$ cmake ..
$ ccmake ..
Best regards,
from paho.mqtt.cpp.
Hi,
Thanks for the suggestions above.
We checked the Makefile inside the /src/samples and utilized the c library paho-mqtt3a to compile it successfully. Not sure it's the very correct way, but at least it's working fine now.
- Copy 3 .so Libraries files in lib folder to /usr/local/lib.
- Use Paho MQTT C library paho-mqtt3a instead of the previous cpp library which can be re-edit in the Makefile.
- Try make the samples, it will work.
Best Regards!
from paho.mqtt.cpp.
For me, this worked from inside my samples directory:
LDLIBS += -L../../lib -L$(PAHO_C_LIB) -lmqttpp -lpaho-mqtt3as
where PAHO_C_LIB ?= /usr/local/lib
I am using the ssl enabled version of paho client C and have those libs installed under /usr/local/lib. For me the paho client C libs go under /usr/local/lib when I did sudo make install
when I built paho client C.
from paho.mqtt.cpp.
I used the same approach that @prateekbansal explain above, and it works. As a prerequisite, Paho MQTT Client C must be compiled and installed properly.
from paho.mqtt.cpp.
I made a patch to add the "install" target (#5)
from paho.mqtt.cpp.
I'm having the same problem.
g++ -Dhidapi -Wall -O2 -std=gnu++11 -fpermissive src/main.cpp src/helpers/utils.cpp src/helpers/help.cpp src/helpers/help.h src/helpers/utils.h src/classes/Keyboard.cpp src/classes/Keyboard.h -o bin/g810-led -lhidapi-hidraw -l paho-mqtt3c -lmqttpp
src/main.cpp: In function ‘void onConnect(void*, MQTTAsync_successData*)’:
src/main.cpp:385:19: warning: invalid conversion from ‘const void*’ to ‘void*’ [-fpermissive]
pubmsg.payload = awkMsg;
^
/usr/bin/ld: cannot find -lmqttpp
collect2: error: ld returned 1 exit status
How do i add the library in the make file of my cpp project?
make file:
CC=g++
CFLAGS=-Wall -O2 -std=gnu++11 -fpermissive
LFLAGS=-l paho-mqtt3c -lmqttpp
from paho.mqtt.cpp.
@guilhermeferreira Allright it seems the library is found, but i'm still getting reference errors like:
/tmp/ccT57dw6.o: In function connlost(void*, char*)': main.cpp:(.text+0x284): undefined reference to
MQTTAsync_connect'
/tmp/ccT57dw6.o: In function onSend(void*, MQTTAsync_successData*)': main.cpp:(.text+0x308): undefined reference to
MQTTAsync_disconnect
etc..
Any idea why tis error occurs?
from paho.mqtt.cpp.
@janoshh it seems you are missing the -lpaho-mqtt3as. But, for accurate diagnostics, could you paste your Makefile?
from paho.mqtt.cpp.
Yes that did the job! I was using the paho-mqtt3c and didn't notice that there was the paho-mqtt3a etc.. thx, saved my day!
from paho.mqtt.cpp.
Related Issues (20)
- CMake Error when PAHO_BUILD_SAMPLES=TRUE (Cannot find src/samples/async_consume_v5.cpp) HOT 1
- Why is this project under Eclipse v1.0 when paho.mqtt.c is under Eclipse v2.0? HOT 1
- Building paho.mqtt.cpp: cmake doesn't pick up my c++ compiler correctly. HOT 4
- Homebrew Installation HOT 1
- Automatic Reconnect Crashes MQTT when `client.reconnect()` is called HOT 7
- Connect failed, more to try HOT 1
- SSL_read() Segmentation fault
- Build with PAHO_WITH_MQTT_C is broken HOT 3
- broker(emqx) already support QUIC, and i Hope client also supports the Quic protocol HOT 1
- arm cross get error HOT 5
- Add getter for the connect_options object (connOpts_) in async_client
- Operation not permitted on try_consume_message async HOT 1
- Base64TestOpenSSL giving problem and how to use only paho-mqtt3as libraray project in visual studio HOT 1
- Cross compilation of paho.mqtt.cpp HOT 9
- cmake issue in Docker container HOT 2
- error in install_paho_mqtt_c.sh in the installation process of the latest version of paho.mqtt.cpp HOT 1
- ThreadSanitizer: lock-order-inversion (potential deadlock) paho 1.2.0
- Linker-Error when compiling with v1.3.2 HOT 5
- connect_options_builder doesn't propagate always properties HOT 5
- Rustls C++ binding into the paho-mqtt HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from paho.mqtt.cpp.