Username: Password:

This forum is now closed - it will remain in READ ONLY mode for reference

Author Topic: Libmosquitto Help  (Read 14802 times)

joyo

  • Newbie
  • *
  • Posts: 4
Re: Libmosquitto Help
« Reply #45 on: December 12, 2016, 04:15:32 PM »
same problem. MQTTController which was working fine in Wheezy but does not compile in Jessie.

made following changes to cpp file:
using namespace mosqpp;

#include </usr/include/mosquitto.h>
#include </usr/include/mosquittopp.h>

MyMosquitto() : mosquittopp::mosquittopp ("PiBrain") { /*MyMosquitto::*/lib_init(); }

see earlier posts.

found the final answer in:
http://stackoverflow.com/questions/26334502/how-to-compile-sample-example-using-libmosquitto

add reference to mosquittopp library to the build instruction in the makefile
${PROGRAMS}: ${SOURCES}
        g++ ${CCFLAGS} -Wall -I../ -lrf24-bcm -lrf24network -lmosquittopp $@.cpp -o $@

now it compiles in Jessie.

Dragos

  • Newbie
  • *
  • Posts: 33
Re: Libmosquitto Help
« Reply #46 on: December 13, 2016, 07:44:37 AM »
I followed your steps but i cant run the make file. It says:

Code: [Select]
Makefile:54: *** missing separator (did you mean TAB instead of 8 spaces?).  Stop.Both files are in the same folder and i try to run
Code: [Select]
make from that specific folder.

Your instruction are too poor and the link you posted goes to a page with one question and one answer so it cannot offer more details about this issue.

joyo

  • Newbie
  • *
  • Posts: 4
Re: Libmosquitto Help
« Reply #47 on: December 13, 2016, 04:29:06 PM »
look in the Makefile, it contains following statement:

${PROGRAMS}: ${SOURCES}
        g++ ${CCFLAGS} -Wall -I../ -lrf24-bcm -lrf24network $@.cpp

replace by:

${PROGRAMS}: ${SOURCES}
        g++ ${CCFLAGS} -Wall -I../ -lrf24-bcm -lrf24network -lmosquittopp $@.cpp

in other words add "-lmosquittopp"

I guess the error means you should not use spaces before the string but use a tab instead. Maybe the tab got replaced when you copied the new string in.

Dragos

  • Newbie
  • *
  • Posts: 33
Re: Libmosquitto Help
« Reply #48 on: December 14, 2016, 03:57:53 AM »
Ok now i got a new fatal err :)

Code: [Select]
pi@raspberrypi:~/MQTTController $ make
g++ -Ofast -mfpu=vfp -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s -Wall -I../ -lrf24-bcm -lrf24network -lmosquittopp MQTTController.cpp
MQTTController.cpp:4:36: fatal error: /usr/include/mosquitto.h: No such file or directory
 #include </usr/include/mosquitto.h>
                                    ^
compilation terminated.
Makefile:50: recipe for target 'MQTTController' failed
make: *** [MQTTController] Error 1

How did you make the changes in the .cpp file using namespace mosqpp ???

joyo

  • Newbie
  • *
  • Posts: 4
Re: Libmosquitto Help
« Reply #49 on: December 14, 2016, 07:18:00 AM »
did you look at the error?

seems to me there is something wrong with the installed mosquitto libs

see the guide how to install them

Dragos

  • Newbie
  • *
  • Posts: 33
Re: Libmosquitto Help
« Reply #50 on: December 14, 2016, 09:41:20 AM »
Well, this is imposible because right now i use an old version of MQTTController that i found on my pc since last year and i can compile the cpp file using sudo ./MQTTController from the folder i have both files! Also make worked! What do you say about this?
The problem is that is so instable i mean i start the oh server and the MQTTController and this works like 5 or 10 min and than i loose connection or i cant figure whats happening! and thats why i wanted to try the last version of MQTTController!

This forum is now closed - it will remain in READ ONLY mode for reference