/* RestClient simple GET request
*
* by Chris Continanza (csquared)
*/
#include <Ethernet.h>
#include <SPI.h>
#include "RestClient.h"
RestClient client = RestClient("localhost:20949/RestService");
//Setup
void setup() {
Serial.begin(9600);
// Connect via DHCP
Serial.println("connect to network");
client.dhcp();
/*
// Can still fall back to manual config:
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
//the IP address for the shield:
byte ip[] = { 192, 168, 2, 11 };
Ethernet.begin(mac,ip);
*/
Serial.println("Setup!");
}
String response;
void loop(){
response = "";
int statusCode = client.get("/get", &response);
Serial.print("Status code from server: ");
Serial.println(statusCode);
Serial.print("Response body from server: ");
Serial.println(response);
delay(1000);
}
Error messages:
Archiving built core (caching) in: C:\Users\barte\AppData\Local\Temp\arduino_cache_923006\core\core_esp8266_esp8266_nodemcuv2_CpuFrequency_80,UploadSpeed_115200,FlashSize_4M3M_7b3e88992d3c2979d0fdbc9fc6d2ed2e.a
sketch\RestClient.cpp.o:(.text._ZN10RestClient4dhcpEv+0xc): undefined reference to `RestClient::begin(unsigned char*)'
sketch\RestClient.cpp.o: In function `RestClient::dhcp()':
sketch/RestClient.cpp:70: undefined reference to `RestClient::begin(unsigned char*)'
collect2.exe: error: ld returned 1 exit status
exit status 1
Error compiling for board NodeMCU 1.0 (ESP-12E Module).
I can't figure out what's going on. Could you help me?