ItKindaWorks / ESPHelper

A library to make using WiFi & MQTT on the ESP8266 easy.
GNU General Public License v3.0
328 stars 67 forks source link

error: 'PubSubClient ESPHelper::client' is private #10

Closed washichi closed 6 years ago

washichi commented 6 years ago

If this is an failure because of my lack of knowledge I apologize in advance.

I tried to run the relayControl example, but I get this error:

In file included from C:\Users\.....\Documents\Projects\Arduino\IOThing_D1\IOThing_D1.ino:25:0:

C:\Users\.....\Documents\Arduino\libraries\ESPHelper\src/ESPHelper.h: In function 'void callback(char*, byte*, unsigned int)':

C:\Users\.....\Documents\Arduino\libraries\ESPHelper\src/ESPHelper.h:166:15: error: 'PubSubClient ESPHelper::client' is private

  PubSubClient client;

               ^

IOThing_D1:93: error: within this context

     myESP.client.publish(statusTopic, "0", true);

           ^

exit status 1
within this context

I Installed the pubsub library (today) via the library manager. (also installed metro library)

Line 25: #include "ESPHelper.h Line 93: myESP.client.publish(statusTopic, "0", true);

tested boards: D1 mini NodeMCU v3 LOLin

narfel commented 6 years ago

You probably solved that by now, but if not make sure you are on version 2.6.0 or higher of PubSubClient. I remember vaguely having the same problem in a different context and was running an outdated version.

washichi commented 6 years ago

I don't think that was the problem since I checked for updates., however I solved it by starting with the RelayControlV2 and stripping it down to basic. If anyone has the same issue I can look into what caused it, but for now I'm happy it's all working, and I can use your awesome ESPHelper library :)