ArduinoWebsocketClient icon indicating copy to clipboard operation
ArduinoWebsocketClient copied to clipboard

Can't compile example

Open chiangy77 opened this issue 9 years ago • 2 comments

Using Arduino 1.6.0 and it won't compile. Error log below: Arduino: 1.6.0 (Windows 7), Board: "Arduino Uno"

Build options changed, rebuilding all

C:\Users\Matt\Documents\Arduino\libraries\ArduinoWebsocketClient-master\WebSocketClient.cpp:30:1: error: 'prog_char' does not name a type prog_char stringVar[] PROGMEM = "{0}"; ^ C:\Users\Matt\Documents\Arduino\libraries\ArduinoWebsocketClient-master\WebSocketClient.cpp:31:1: error: 'prog_char' does not name a type prog_char clientHandshakeLine1[] PROGMEM = "GET {0} HTTP/1.1"; ^ C:\Users\Matt\Documents\Arduino\libraries\ArduinoWebsocketClient-master\WebSocketClient.cpp:32:1: error: 'prog_char' does not name a type prog_char clientHandshakeLine2[] PROGMEM = "Upgrade: WebSocket"; ^ C:\Users\Matt\Documents\Arduino\libraries\ArduinoWebsocketClient-master\WebSocketClient.cpp:33:1: error: 'prog_char' does not name a type prog_char clientHandshakeLine3[] PROGMEM = "Connection: Upgrade"; ^ C:\Users\Matt\Documents\Arduino\libraries\ArduinoWebsocketClient-master\WebSocketClient.cpp:34:1: error: 'prog_char' does not name a type prog_char clientHandshakeLine4[] PROGMEM = "Host: {0}"; ^ C:\Users\Matt\Documents\Arduino\libraries\ArduinoWebsocketClient-master\WebSocketClient.cpp:35:1: error: 'prog_char' does not name a type prog_char clientHandshakeLine5[] PROGMEM = "Origin: ArduinoWebSocketClient"; ^ C:\Users\Matt\Documents\Arduino\libraries\ArduinoWebsocketClient-master\WebSocketClient.cpp:36:1: error: 'prog_char' does not name a type prog_char serverHandshake[] PROGMEM = "HTTP/1.1 101"; ^ C:\Users\Matt\Documents\Arduino\libraries\ArduinoWebsocketClient-master\WebSocketClient.cpp:38:48: error: variable 'WebSocketClientStringTable' must be const in order to be put into read-only section by means of 'attribute((progmem))' PROGMEM const char *WebSocketClientStringTable[] = ^ C:\Users\Matt\Documents\Arduino\libraries\ArduinoWebsocketClient-master\WebSocketClient.cpp:40:5: error: 'stringVar' was not declared in this scope stringVar, ^ C:\Users\Matt\Documents\Arduino\libraries\ArduinoWebsocketClient-master\WebSocketClient.cpp:41:5: error: 'clientHandshakeLine1' was not declared in this scope clientHandshakeLine1, ^ C:\Users\Matt\Documents\Arduino\libraries\ArduinoWebsocketClient-master\WebSocketClient.cpp:42:5: error: 'clientHandshakeLine2' was not declared in this scope clientHandshakeLine2, ^ C:\Users\Matt\Documents\Arduino\libraries\ArduinoWebsocketClient-master\WebSocketClient.cpp:43:5: error: 'clientHandshakeLine3' was not declared in this scope clientHandshakeLine3, ^ C:\Users\Matt\Documents\Arduino\libraries\ArduinoWebsocketClient-master\WebSocketClient.cpp:44:5: error: 'clientHandshakeLine4' was not declared in this scope clientHandshakeLine4, ^ C:\Users\Matt\Documents\Arduino\libraries\ArduinoWebsocketClient-master\WebSocketClient.cpp:45:5: error: 'clientHandshakeLine5' was not declared in this scope clientHandshakeLine5, ^ C:\Users\Matt\Documents\Arduino\libraries\ArduinoWebsocketClient-master\WebSocketClient.cpp:46:5: error: 'serverHandshake' was not declared in this scope serverHandshake ^ Error compiling.

This report would have more information with "Show verbose output during compilation" enabled in File > Preferences.

chiangy77 avatar Oct 13 '15 03:10 chiangy77

Same here. I followed these guidelines to get rid of most of the errors but the only line of code I can't seem to get the error to go away is this one.

rclai avatar Oct 15 '15 16:10 rclai

that line needs to be changed to PROGMEM const char* const WebSocketClientStringTable[] =

this is how it should be changed:

const char stringVar[] PROGMEM = "{0}"; const char clientHandshakeLine1[] PROGMEM = "GET {0} HTTP/1.1"; const char clientHandshakeLine2[] PROGMEM = "Upgrade: WebSocket"; const char clientHandshakeLine3[] PROGMEM = "Connection: Upgrade"; const char clientHandshakeLine4[] PROGMEM = "Host: {0}"; const char clientHandshakeLine5[] PROGMEM = "Origin: ArduinoWebSocketClient"; const char serverHandshake[] PROGMEM = "HTTP/1.1 101";

PROGMEM const char* const WebSocketClientStringTable[] = {
stringVar, clientHandshakeLine1, clientHandshakeLine2, clientHandshakeLine3, clientHandshakeLine4, clientHandshakeLine5, serverHandshake };

then it compiles fine

avenantsoftware avatar Nov 03 '15 17:11 avenantsoftware