#1 - 2022-10-19 12:47
矮木油希希 (都是异端!)
总有一天我会一次写对
标题歧义
报的错不弱智,弱智的是我
#2 - 2022-10-19 12:47
(都是异端!)
Arduino:1.8.19 (Mac OS X), 开发板:"ESP32 Dev Module, Disabled, Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS), 240MHz (WiFi/BT), QIO, 80MHz, 4MB (32Mb), 921600, None"
/Users/mucc/Desktop/7620test/weather.ino: In function 'void weather()':
weather:37:7: error: 'StaticJsonDocument' was not declared in this scope
       StaticJsonDocument<1024> doc;
       ^
weather:37:32: error: 'doc' was not declared in this scope
       StaticJsonDocument<1024> doc;
                                ^
weather:39:38: error: 'deserializeJson' was not declared in this scope
       deserializeJson(doc, jsonAnswer);
                                      ^
weather:44:7: error: 'JsonObject' was not declared in this scope
       JsonObject weather_0 = doc["weather"][0];
       ^
weather:45:26: error: 'weather_0' was not declared in this scope
       int weather_0_id = weather_0["id"]; // 801
                          ^
weather:52:18: error: expected ';' before 'main'
       JsonObject main = doc["main"];
                  ^
weather:53:25: error: 'main' was not declared in this scope
       float main_temp = main["temp"]; // 20.64
                         ^
weather:69:18: error: expected ';' before 'sys'
       JsonObject sys = doc["sys"];
                  ^
weather:70:22: error: 'sys' was not declared in this scope
       int sys_type = sys["type"]; // 1
                      ^
"WiFiClient.h" 对应多个库
已使用: /Users/mucc/Library/Arduino15/packages/esp32/hardware/esp32/1.0.6/libraries/WiFi
未使用:/private/var/folders/07/xjh5ldg900x3k7ct7spq9_kr0000gn/T/AppTranslocation/B00FD9EE-D5DD-413D-A13F-4781B11A0CFF/d/Arduino.app/Contents/Java/libraries/WiFi
exit status 1
'StaticJsonDocument' was not declared in this scope
在文件 -> 首选项开启
“编译过程中显示详细输出”选项
这份报告会包含更多信息。
#2-1 - 2022-10-19 12:48
矮木油希希
忘了#include <ArduinoJson.h>