-->
Page 1 of 1

MQTT - knolleary or ESP8266 library, where am I going wrong

PostPosted: Sun Jun 21, 2015 1:24 pm
by questuk
Hi,

I am trying to use MQTT using the following:
Ethernet Arduino board
Using ESP2866 module

For the past 3 years I have been using this library, https://github.com/knolleary/pubsubclient this has worked well.

I now wish to use the ESP8266 with MQTT using this library, https://github.com/Imroy/pubsubclient

Both of these have there own PubSubClient.h , so cannot be in my arduino library at the same time !


My problem is when I compile my code for Ethernet Arduino it will only compile error free using the knolleary library and the ESP8266 will only compile error free using the Imroy library.

This gives me the problem of installing the correct library every time I use ESP8266 or Ethernet Arduino code.

Am I missing something surely i should have one library to be able to do both ?


Thanks


Regards


Gary

Re: MQTT - knolleary or ESP8266 library, where am I going wr

PostPosted: Tue Jun 23, 2015 4:51 am
by tytower
The two libraries must be different and therefore have different classes and requirements .
ie Library one defines cat(int);
Library two defines cat(int,int);
so one wants a call to it with two numbers cat(15,24);
the other will not recognise it because it does not fit into cat(int);
Compiler rejects it

So you have to choose one or the other , or, go in and change one to suit the other .
Another option may be to rename one libraries files to say cat1.h, cat1.cpp and change in your program the call to cat(int); to cat1(int);