Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By questuk
#21119 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
User avatar
By tytower
#21352 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);