espduino icon indicating copy to clipboard operation
espduino copied to clipboard

Error "'ESP' does not name a type ESP *esp;"

Open janpaul1992 opened this issue 8 years ago • 3 comments

Hi, recently I tried to use this project for communicating with a rest api. I downloaded the library and loaded the example but something is wrong. The arduino compiler says:

libraries\espduino/rest.h:30:3: error: 'ESP' does not name a type ESP *esp;

It also says:

libraries\espduino/rest.h:38:12: error: expected ')' before '*' token REST(ESP *e);

I didn't make any changes in the library or what so ever. Just downloaded it, restarted arduino. Imported the library and copy+pasted the sketch.

Someone has a clue what's going on?

Thanks in advance,

Jan Paul

janpaul1992 avatar Oct 28 '15 08:10 janpaul1992

https://raw.githubusercontent.com/tuanpmt/espduino/master/espduino/examples/rest/rest.ino builds just fine for me ; However I can reproduce the error when I include both MQTT.H and REST.H in one arduino sketch

walduino avatar Dec 12 '15 21:12 walduino

Same issue here. @walduino do you use windows or any fs which is not case sensitive?

Using library SoftwareSerial in folder: /home/bongo/.arduino15/packages/esp8266/hardware/esp8266/2.1.0/libraries/SoftwareSerial 
Using library espduino in folder: /home/bongo/Arduino/libraries/espduino (legacy)

/home/bongo/.arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/1.20.0-26-gb404fb9-2/bin/xtensa-lx106-elf-g++ -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ -I/home/bongo/.arduino15/packages/esp8266/hardware/esp8266/2.1.0/tools/sdk/include -c -w -Os -g -mlongcalls -mtext-section-literals -fno-exceptions -fno-rtti -falign-functions=4 -std=c++11 -MMD -ffunction-sections -fdata-sections -DF_CPU=80000000L -DARDUINO=10604 -DARDUINO_ESP8266_ESP01 -DARDUINO_ARCH_ESP8266 -DESP8266 -I/home/bongo/.arduino15/packages/esp8266/hardware/esp8266/2.1.0/cores/esp8266 -I/home/bongo/.arduino15/packages/esp8266/hardware/esp8266/2.1.0/variants/generic -I/home/bongo/.arduino15/packages/esp8266/hardware/esp8266/2.1.0/libraries/SoftwareSerial -I/home/bongo/Arduino/libraries/espduino -I/home/bongo/Arduino/libraries/disabled /tmp/build6512057098156652910.tmp/sketch_mar19a.cpp -o /tmp/build6512057098156652910.tmp/sketch_mar19a.cpp.o 
In file included from sketch_mar19a.ino:10:0:
/home/bongo/Arduino/libraries/espduino/rest.h:30:3: error: 'ESP' does not name a type
   ESP *esp;
   ^
/home/bongo/Arduino/libraries/espduino/rest.h:38:12: error: expected ')' before '*' token
   REST(ESP *e);
            ^
sketch_mar19a.ino:14:1: error: 'ESP' does not name a type
sketch_mar19a.ino:16:12: error: 'esp' was not declared in this scope
sketch_mar19a.ino: In function 'void setup()':
sketch_mar19a.ino:41:3: error: 'esp' was not declared in this scope
sketch_mar19a.ino: In function 'void loop()':
sketch_mar19a.ino:62:3: error: 'esp' was not declared in this scope
'ESP' does not name a type

I can't see any reason for this behaviour despite looking at it for hours...

bong0 avatar Mar 19 '16 12:03 bong0

I got the same error...

In file included from E:\Arduino\projects\MQTTDemo\MQTTDemo.ino:3:0: E:\Arduino\projects\libraries\espduino/mqtt.h:18:3: error: 'ESP' does not name a type ESP esp; ^ E:\Arduino\projects\libraries\espduino/mqtt.h:27:12: error: expected ')' before '' token MQTT(ESP esp); ^ MQTTDemo:7: error: 'ESP' does not name a type ESP esp(&Serial, &debugPort, 13); ^ E:\Arduino\projects\MQTTDemo\MQTTDemo.ino: In function 'void wifiCb(uint8_t)': MQTTDemo:13: error: 'esp' was not declared in this scope esp.mqttConnect("mqtt.domain.io", 1880); ^ E:\Arduino\projects\MQTTDemo\MQTTDemo.ino: In function 'void mqttConnected(uint32_t)': MQTTDemo:19: error: 'esp' was not declared in this scope esp.subscribe("/topic"); ^ E:\Arduino\projects\MQTTDemo\MQTTDemo.ino: In function 'void mqttData(uint32_t*)': MQTTDemo:34: error: 'mqtt_event_data_t' was not declared in this scope mqtt_event_data_t *event_data = (mqtt_event_data_t *)args; ^ MQTTDemo:34: error: 'event_data' was not declared in this scope mqtt_event_data_t *event_data = (mqtt_event_data_t *)args; ^ MQTTDemo:34: error: expected primary-expression before ')' token mqtt_event_data_t *event_data = (mqtt_event_data_t *)args; ^ MQTTDemo:34: error: expected ';' before 'args' mqtt_event_data_t *event_data = (mqtt_event_data_t *)args; ^ E:\Arduino\projects\MQTTDemo\MQTTDemo.ino: In function 'void setup()': MQTTDemo:59: error: 'esp' was not declared in this scope esp.wifiCb.attach(&wifiCb); ^ E:\Arduino\projects\MQTTDemo\MQTTDemo.ino: In function 'void loop()': MQTTDemo:73: error: 'esp' was not declared in this scope esp.process();

chenhy82 avatar Sep 29 '16 03:09 chenhy82