stelgenhof / AiLight

AiLight is a custom firmware for the esp8266 based Ai-Thinker (or equivalent) RGBW WiFi light bulbs
MIT License
256 stars 41 forks source link

Errors during compile 'WIFI_SSID' was not declared in this scope #32

Closed rust84 closed 6 years ago

rust84 commented 6 years ago

Encountering an error when trying to compile. Configured the default values for wifi and mqtt in src/config.h. The compiler is complaining about variables not being declared.

I noticed that if I comment out the wifi configuration (default) then the build finishes ok.

Am using platformio installed with pip. Tested on Windows and Linux and it is the same. See my config below.

`** If you like PlatformIO, please:

[Wed Mar 7 13:20:34 2018] Processing dev (extra_scripts: build.py; build_flags: -DDEBUG -g -Wall -Wl,-Tesp8266.flash.1m128.ld; lib_deps: ArduinoJson, AsyncMqttClient, xoseperez/my9291, ESPAsyncTCP, ESP Async WebServer; platform: espressif8266; board: esp8285; framework: arduino)

LibraryManager: Installing id=64 Downloading [####################################] 100% Unpacking [####################################] 100% LibraryManager: Installing id=346 Downloading [####################################] 100% Unpacking [####################################] 100% LibraryManager: Installing id=305 @ ^1.1.0 Downloading [####################################] 100% Unpacking [####################################] 100% LibraryManager: Installing id=1826 @ ^1.0.0 Downloading [####################################] 100% Unpacking [####################################] 100% LibraryManager: Installing my9291 git version 2.7.4 Cloning into '/home/russell/repos/AiLight/.piolibdeps/_tmp_installing-69RTfQ-package'... remote: Counting objects: 20, done. remote: Compressing objects: 100% (17/17), done. remote: Total 20 (delta 0), reused 10 (delta 0), pack-reused 0 Unpacking objects: 100% (20/20), done. Checking connectivity... done. LibraryManager: Installing id=306 Downloading [####################################] 100% Unpacking [####################################] 100% PlatformManager: Installing espressif8266 Downloading [####################################] 100% Unpacking [####################################] 100% espressif8266 @ 1.6.0 has been successfully installed! The platform 'espressif8266' has been successfully installed! The rest of packages will be installed automatically depending on your build environment. PackageManager: Installing toolchain-xtensa @ ~1.40802.0 Downloading [####################################] 100%
Unpacking [####################################] 100%
PackageManager: Installing tool-esptool @ ~1.409.0 Downloading [####################################] 100% Unpacking [####################################] 100% PackageManager: Installing framework-arduinoespressif8266 @ ~1.20400.0 Downloading [####################################] 100%
Unpacking [####################################] 100%
CorePackageManager: Installing tool-scons @ ~3.20501.2 Downloading [####################################] 100% Unpacking [####################################] 100% tool-scons @ 3.20501.2 has been successfully installed! Verbose mode can be enabled via -v, --verbose option Converting main.ino Collected 32 compatible libraries Scanning dependencies... Library Dependency Graph ( http://bit.ly/configure-pio-ldf ) |-- v5.13.1 |-- v0.8.2 | |-- v1.1.3 | | |-- v1.0 |-- v2.0.0 #fd9271c |-- v1.1.3 | |-- v1.0 |-- v1.1.1 | |-- v1.1.3 | | |-- v1.0 | |-- v1.0 | |-- v1.0 | |-- v5.13.1 |-- | |-- v2.0.0 #fd9271c |-- v1.0 |-- v1.0 | |-- v1.0 | |-- | | |-- v1.0 |-- | |-- v1.0 |-- v1.0 |-- v1.0 |-- v1.0 Compiling .pioenvs/dev/src/main.ino.cpp.o Archiving .pioenvs/dev/libFrameworkArduinoVariant.a Indexing .pioenvs/dev/libFrameworkArduinoVariant.a Compiling .pioenvs/dev/FrameworkArduino/Esp.cpp.o Compiling .pioenvs/dev/FrameworkArduino/FS.cpp.o Compiling .pioenvs/dev/FrameworkArduino/FunctionalInterrupt.cpp.o Compiling .pioenvs/dev/FrameworkArduino/HardwareSerial.cpp.o Compiling .pioenvs/dev/FrameworkArduino/IPAddress.cpp.o Compiling .pioenvs/dev/FrameworkArduino/MD5Builder.cpp.o Compiling .pioenvs/dev/FrameworkArduino/Print.cpp.o Compiling .pioenvs/dev/FrameworkArduino/Schedule.cpp.o In file included from src/main.h:20:0, from /home/russell/repos/AiLight/src/main.ino:13: src/config.h:43:1: error: 'define' does not name a type define WIFI_SSID "Asgard2" ^ In file included from lib/AiLight/AiLight.hpp:19:0, from src/main.h:35, from /home/russell/repos/AiLight/src/main.ino:13: .piolibdeps/my9291/src/my9291.h:41:3: error: 'my9291_cmd_one_shot_t' does not name a type } my9291_cmd_one_shot_t; ^ .piolibdeps/my9291/src/my9291.h:72:9: error: 'my9291_cmd_one_shot_t' does not name a type my9291_cmd_one_shot_t one_shot:1; ^ Compiling .pioenvs/dev/FrameworkArduino/Stream.cpp.o Compiling .pioenvs/dev/FrameworkArduino/StreamString.cpp.o Compiling .pioenvs/dev/FrameworkArduino/Tone.cpp.o Compiling .pioenvs/dev/FrameworkArduino/Updater.cpp.o /home/russell/repos/AiLight/src/main.ino: In function 'void loadFactoryDefaults()': /home/russell/repos/AiLight/src/main.ino:57:19: error: 'MQTT_PORT' was not declared in this scope cfg.mqtt_port = MQTT_PORT; ^ /home/russell/repos/AiLight/src/main.ino:58:30: error: 'MQTT_SERVER' was not declared in this scope os_strcpy(cfg.mqtt_server, MQTT_SERVER); ^ /home/russell/repos/AiLight/src/main.ino:76:28: error: 'WIFI_SSID' was not declared in this scope os_strcpy(cfg.wifi_ssid, WIFI_SSID); ^ /home/russell/repos/AiLight/src/main.ino:77:27: error: 'WIFI_PSK' was not declared in this scope os_strcpy(cfg.wifi_psk, WIFI_PSK); ^ Compiling .pioenvs/dev/FrameworkArduino/WMath.cpp.o /home/russell/repos/AiLight/src/_web.ino: In function 'void wsProcessMessage(uint8_t, char*, size_t)': /home/russell/repos/AiLight/src/_web.ino:188:34: error: 'MQTT_PORT' was not declared in this scope : MQTT_PORT; ^ Compiling .pioenvs/dev/FrameworkArduino/WString.cpp.o Compiling .pioenvs/dev/FrameworkArduino/abi.cpp.o Compiling .pioenvs/dev/FrameworkArduino/base64.cpp.o *** [.pioenvs/dev/src/main.ino.cpp.o] Error 1 ============================================================= [ERROR] Took 33.12 seconds =============================================================

===================================================================== [SUMMARY] ===================================================================== Environment dev [ERROR] Environment dev-ota [SKIP] Environment prod [SKIP] Environment prod-ota [SKIP] ============================================================= [ERROR] Took 33.12 seconds =============================================================`

`/**

/**

define HOSTNAME "AiLight"

define ADMIN_PASSWORD "hinotori"

/**

/**

/**

define MQTT_PAYLOAD_ON "ON"

define MQTT_PAYLOAD_OFF "OFF"

define MQTT_STATUS_ONLINE "online"

define MQTT_STATUS_OFFLINE "offline"

define MQTT_HOMEASSISTANT_DISCOVERY_ENABLED false

define MQTT_HOMEASSISTANT_DISCOVERY_PREFIX "homeassistant"

/**

`** If you like PlatformIO, please:

[Wed Mar 7 13:20:34 2018] Processing dev (extra_scripts: build.py; build_flags: -DDEBUG -g -Wall -Wl,-Tesp8266.flash.1m128.ld; lib_deps: ArduinoJson, AsyncMqttClient, xoseperez/my9291, ESPAsyncTCP, ESP Async WebServer; platform: espressif8266; board: esp8285; framework: arduino)

LibraryManager: Installing id=64 Downloading [####################################] 100% Unpacking [####################################] 100% LibraryManager: Installing id=346 Downloading [####################################] 100% Unpacking [####################################] 100% LibraryManager: Installing id=305 @ ^1.1.0 Downloading [####################################] 100% Unpacking [####################################] 100% LibraryManager: Installing id=1826 @ ^1.0.0 Downloading [####################################] 100% Unpacking [####################################] 100% LibraryManager: Installing my9291 git version 2.7.4 Cloning into '/home/russell/repos/AiLight/.piolibdeps/_tmp_installing-69RTfQ-package'... remote: Counting objects: 20, done. remote: Compressing objects: 100% (17/17), done. remote: Total 20 (delta 0), reused 10 (delta 0), pack-reused 0 Unpacking objects: 100% (20/20), done. Checking connectivity... done. LibraryManager: Installing id=306 Downloading [####################################] 100% Unpacking [####################################] 100% PlatformManager: Installing espressif8266 Downloading [####################################] 100% Unpacking [####################################] 100% espressif8266 @ 1.6.0 has been successfully installed! The platform 'espressif8266' has been successfully installed! The rest of packages will be installed automatically depending on your build environment. PackageManager: Installing toolchain-xtensa @ ~1.40802.0 Downloading [####################################] 100%
Unpacking [####################################] 100%
PackageManager: Installing tool-esptool @ ~1.409.0 Downloading [####################################] 100% Unpacking [####################################] 100% PackageManager: Installing framework-arduinoespressif8266 @ ~1.20400.0 Downloading [####################################] 100%
Unpacking [####################################] 100%
CorePackageManager: Installing tool-scons @ ~3.20501.2 Downloading [####################################] 100% Unpacking [####################################] 100% tool-scons @ 3.20501.2 has been successfully installed! Verbose mode can be enabled via -v, --verbose option Converting main.ino Collected 32 compatible libraries Scanning dependencies... Library Dependency Graph ( http://bit.ly/configure-pio-ldf ) |-- v5.13.1 |-- v0.8.2 | |-- v1.1.3 | | |-- v1.0 |-- v2.0.0 #fd9271c |-- v1.1.3 | |-- v1.0 |-- v1.1.1 | |-- v1.1.3 | | |-- v1.0 | |-- v1.0 | |-- v1.0 | |-- v5.13.1 |-- | |-- v2.0.0 #fd9271c |-- v1.0 |-- v1.0 | |-- v1.0 | |-- | | |-- v1.0 |-- | |-- v1.0 |-- v1.0 |-- v1.0 |-- v1.0 Compiling .pioenvs/dev/src/main.ino.cpp.o Archiving .pioenvs/dev/libFrameworkArduinoVariant.a Indexing .pioenvs/dev/libFrameworkArduinoVariant.a Compiling .pioenvs/dev/FrameworkArduino/Esp.cpp.o Compiling .pioenvs/dev/FrameworkArduino/FS.cpp.o Compiling .pioenvs/dev/FrameworkArduino/FunctionalInterrupt.cpp.o Compiling .pioenvs/dev/FrameworkArduino/HardwareSerial.cpp.o Compiling .pioenvs/dev/FrameworkArduino/IPAddress.cpp.o Compiling .pioenvs/dev/FrameworkArduino/MD5Builder.cpp.o Compiling .pioenvs/dev/FrameworkArduino/Print.cpp.o Compiling .pioenvs/dev/FrameworkArduino/Schedule.cpp.o In file included from src/main.h:20:0, from /home/russell/repos/AiLight/src/main.ino:13: src/config.h:43:1: error: 'define' does not name a type define WIFI_SSID "Asgard2" ^ In file included from lib/AiLight/AiLight.hpp:19:0, from src/main.h:35, from /home/russell/repos/AiLight/src/main.ino:13: .piolibdeps/my9291/src/my9291.h:41:3: error: 'my9291_cmd_one_shot_t' does not name a type } my9291_cmd_one_shot_t; ^ .piolibdeps/my9291/src/my9291.h:72:9: error: 'my9291_cmd_one_shot_t' does not name a type my9291_cmd_one_shot_t one_shot:1; ^ Compiling .pioenvs/dev/FrameworkArduino/Stream.cpp.o Compiling .pioenvs/dev/FrameworkArduino/StreamString.cpp.o Compiling .pioenvs/dev/FrameworkArduino/Tone.cpp.o Compiling .pioenvs/dev/FrameworkArduino/Updater.cpp.o /home/russell/repos/AiLight/src/main.ino: In function 'void loadFactoryDefaults()': /home/russell/repos/AiLight/src/main.ino:57:19: error: 'MQTT_PORT' was not declared in this scope cfg.mqtt_port = MQTT_PORT; ^ /home/russell/repos/AiLight/src/main.ino:58:30: error: 'MQTT_SERVER' was not declared in this scope os_strcpy(cfg.mqtt_server, MQTT_SERVER); ^ /home/russell/repos/AiLight/src/main.ino:76:28: error: 'WIFI_SSID' was not declared in this scope os_strcpy(cfg.wifi_ssid, WIFI_SSID); ^ /home/russell/repos/AiLight/src/main.ino:77:27: error: 'WIFI_PSK' was not declared in this scope os_strcpy(cfg.wifi_psk, WIFI_PSK); ^ Compiling .pioenvs/dev/FrameworkArduino/WMath.cpp.o /home/russell/repos/AiLight/src/_web.ino: In function 'void wsProcessMessage(uint8_t, char*, size_t)': /home/russell/repos/AiLight/src/_web.ino:188:34: error: 'MQTT_PORT' was not declared in this scope : MQTT_PORT; ^ Compiling .pioenvs/dev/FrameworkArduino/WString.cpp.o Compiling .pioenvs/dev/FrameworkArduino/abi.cpp.o Compiling .pioenvs/dev/FrameworkArduino/base64.cpp.o *** [.pioenvs/dev/src/main.ino.cpp.o] Error 1 ============================================================= [ERROR] Took 33.12 seconds =============================================================

===================================================================== [SUMMARY] ===================================================================== Environment dev [ERROR] Environment dev-ota [SKIP] Environment prod [SKIP] Environment prod-ota [SKIP] ============================================================= [ERROR] Took 33.12 seconds =============================================================`

`/**

/**

define HOSTNAME "AiLight"

define ADMIN_PASSWORD "hinotori"

/**

/**

/**

define MQTT_PAYLOAD_ON "ON"

define MQTT_PAYLOAD_OFF "OFF"

define MQTT_STATUS_ONLINE "online"

define MQTT_STATUS_OFFLINE "offline"

define MQTT_HOMEASSISTANT_DISCOVERY_ENABLED false

define MQTT_HOMEASSISTANT_DISCOVERY_PREFIX "homeassistant"

/**

stelgenhof commented 6 years ago

I think you made a typ-o of some sorts when editing the config.h file. Most likely you didn't close a string (using quotes or double quotes) properly in the config.h file. If that occurs, then basically the syntax is garbled which could explain these errors.

Can you please check if your config.h file is correctly edited?

rust84 commented 6 years ago

It was my fault for removing the # thinking it was already commented out. Been a long time since I did anything with c! Thanks for responding anyway.