Undifined reference to 'ESP8266:

Hi All

I am having issues compiling the Cayenne ESP8266 WiFi Shield sketch for an Arduino Uno (Not Nano). I have only added in my WiFi details and the Cayenne Authentication Info. Otherwise the code is straight off the website.

/*
This sketch connects to the Cayenne server using an ESP8266 WiFi module as a shield connected via a hardware serial to an Arduino.

The CayenneMQTT Library is required to run this sketch. If you have not already done so you can install it from the Arduino IDE Library Manager.

Steps:
1. Install the ESP8266SerialLibrary.zip library via the Arduino IDE (Sketch->Include Library->Add .ZIP Library) from the Cayenne extras/libraries
 folder (e.g. My Documents\Arduino\libraries\CayenneMQTT\extras\libraries) to compile this example.
2. Connect the ESP8266 as a shield to your Arduino. This example uses the Serial1 hardware serial pins available on the Mega. You can also try 
using a software serial, though it may be less stable.
3. Set the Cayenne authentication info to match the authentication info from the Dashboard.
4. Set the network name and password.
5. Compile and upload the sketch.
6. A temporary widget will be automatically generated in the Cayenne Dashboard. To make the widget permanent click the plus sign on the widget.

NOTE: This code requires ESP8266 firmware version 1.0.0 (AT v0.22) or later.
*/

//#define CAYENNE_DEBUG       // Uncomment to show debug messages
#define CAYENNE_PRINT Serial  // Comment this out to disable prints and save space
#include <CayenneMQTTESP8266Shield.h>

// WiFi network info.
char ssid[] = "MY_WIFI_NETWORK";
char wifiPassword[] = "MY_WIFI_PASSWORD";

// Cayenne authentication info. This should be obtained from the Cayenne Dashboard.
char username[] = "MY_CAYENNE_ASSIGNED_USERNAME";
char password[] = "MY_CAYENNE_ASSIGNED_PASSWORD";
char clientID[] = "MY_CAYENNE_ASSSIGNED_CLIENT_ID";

// Set ESP8266 Serial object. In this example we use the Serial1 hardware serial which is available on boards like the Arduino Mega.
#define EspSerial Serial


ESP8266 wifi(&EspSerial);

void setup()
{
 Serial.begin(9600);
 delay(10);

// Set ESP8266 baud rate
EspSerial.begin(115200);
delay(10);

Cayenne.begin(username, password, clientID, wifi, ssid, wifiPassword);
}

void loop()
{
Cayenne.loop();
}

// Default function for sending sensor data at intervals to Cayenne.
// You can also use functions for specific channels, e.g CAYENNE_OUT(1) for sending channel 1 data.
CAYENNE_OUT_DEFAULT()
{
// Write data to Cayenne here. This example just sends the current uptime in milliseconds on virtual 
channel 0.
  Cayenne.virtualWrite(0, millis());
// Some examples of other functions you can use to send data.
//Cayenne.celsiusWrite(1, 22.0);
//Cayenne.luxWrite(2, 700);
//Cayenne.virtualWrite(3, 50, TYPE_PROXIMITY, UNIT_CENTIMETER);
}

// Default function for processing actuator commands from the Cayenne Dashboard.
// You can also use functions for specific channels, e.g CAYENNE_IN(1) for channel 1 commands.
CAYENNE_IN_DEFAULT()
{
  CAYENNE_LOG("Channel %u, value %s", request.channel, getValue.asString());
  //Process message here. If there is an error set an error message using getValue.setError(), e.g 
  getValue.setError("Error message");
}

Originally The error code was much longer but after some digging and fixing I have been able to shorten it. I noticed the code " undefined reference to 'ESP8266: " keeps popping up but I have not been able to find any information on it nor probe around to find the issue

C:\Users\Mark\AppData\Local\Temp\cceZ9HMf.ltrans0.ltrans.o: In function `ESP8266Client::stop()':
C:\Program Files (x86)\Arduino\libraries\Cayenne-MQTT-Arduino-master\src/CayenneMQTTESP8266Shield.h:129: undefined reference to `ESP8266::releaseTCP(unsigned char)'
C:\Users\Mark\AppData\Local\Temp\cceZ9HMf.ltrans0.ltrans.o: In function `ESP8266Client::available()':
C:\Program Files (x86)\Arduino\libraries\Cayenne-MQTT-Arduino-master\src/CayenneMQTTESP8266Shield.h:102: undefined reference to `ESP8266::run()'
C:\Users\Mark\AppData\Local\Temp\cceZ9HMf.ltrans0.ltrans.o: In function `ESP8266Client::write(unsigned char const*, unsigned int)':
C:\Program Files (x86)\Arduino\libraries\Cayenne-MQTT-Arduino-master\src/CayenneMQTTESP8266Shield.h:95: undefined reference to `ESP8266::send(unsigned char, unsigned char const*, unsigned long)'
C:\Users\Mark\AppData\Local\Temp\cceZ9HMf.ltrans0.ltrans.o: In function `ESP8266Client::connect(char const*, unsigned int)':
C:\Program Files (x86)\Arduino\libraries\Cayenne-MQTT-Arduino-master\src/CayenneMQTTESP8266Shield.h:88: undefined reference to `ESP8266::createTCP(unsigned char, String, unsigned long)'
C:\Users\Mark\AppData\Local\Temp\cceZ9HMf.ltrans0.ltrans.o: In function `global constructors keyed to 65535_0_Network_Test.ino.cpp.o.3220':
<artificial>:(.text.startup+0xb2): undefined reference to `ESP8266::ESP8266(Stream*)'
C:\Users\Mark\AppData\Local\Temp\cceZ9HMf.ltrans0.ltrans.o: In function `connectWiFi':
C:\Program Files (x86)\Arduino\libraries\Cayenne-MQTT-Arduino-master\src/CayenneMQTTESP8266Shield.h:58: undefined reference to `ESP8266::kick()'
C:\Program Files (x86)\Arduino\libraries\Cayenne-MQTT-Arduino-master\src/CayenneMQTTESP8266Shield.h:62: undefined reference to `ESP8266::setEcho(unsigned char)'
C:\Program Files (x86)\Arduino\libraries\Cayenne-MQTT-Arduino-master\src/CayenneMQTTESP8266Shield.h:66: undefined reference to `ESP8266::enableMUX()'
C:\Program Files (x86)\Arduino\libraries\Cayenne-MQTT-Arduino-master\src/CayenneMQTTESP8266Shield.h:69: undefined reference to `ESP8266::setOprToStation(unsigned char, unsigned char)'
C:\Program Files (x86)\Arduino\libraries\Cayenne-MQTT-Arduino-master\src/CayenneMQTTESP8266Shield.h:73: undefined reference to `ESP8266::joinAP(String, String, unsigned char)'
collect2.exe: error: ld returned 1 exit status
exit status 1
Error compiling for board Arduino Uno.

Any info on the issue is greatly appreciated

Thanks
Mark

you have selected arduino uno. change it to arduino nano board.

Hi sharmik

Late night me typing up the post had a stupid moment and wrote nano instead of uno.

I am using a uno

Thanks
Mark

have you followed this step?

Ok its Silly me time

I had installed it but into the Cayenne MQTT library file and not the main Arduino library file. I moved it and it works now.

Thanks you for your help

Hello, hope you are doing fine, I’m getting trouble adding devices to my cayenne dashboard, whenever I select the “add divice or widget” option I can’t fine the widgets can you help please