ArduinoIDEで問題なくビルドできたコードをVScodeの試験の目的でライブラリをインストールし、ソースを一部コピペしましたが、エラーが発生します。
M5Stack.hだけを利用するだけのコードだとビルドできますが、httpClient.hを使ったとたんにエラーが大量に出ます。
このエラー解決のために三連休をすべてつぶしましたが解決できず...
どなたかご指導をお願いします。
■VScideのversion
1.39.2
■Pythonのversion
3.7.5
#include <M5Stack.h> #include <HTTPClient.h> HTTPClient http; void setup() { M5.begin(); M5.Lcd.print("TEST"); delay(1000); } void loop() { M5.Lcd.print("TEST"); delay(1000); }
■ビルド時のエラー
> Executing task in folder TESTver1: C:\Users\<ユーザー名>.platformio\penv\Scripts\platformio.exe run < Processing m5stack-grey (platform: espressif32; board: m5stack-grey; framework: arduino) --------------------------------------------------------------------------------------------------------------------------------- Verbose mode can be enabled via `-v, --verbose` option CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/m5stack-grey.html PLATFORM: Espressif 32 1.11.1 > M5Stack GREY ESP32 HARDWARE: ESP32 240MHz, 520KB RAM, 16MB Flash DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa) PACKAGES: toolchain-xtensa32 2.50200.80 (5.2.0), framework-arduinoespressif32 2.10004.191002 (1.0.4), tool-esptoolpy 1.20600.0 (2.6.0) LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf LDF Modes: Finder ~ chain, Compatibility ~ soft Unicode decode error has occurred, please remove invalid (non-ASCII or non-UTF8) characters from C:\Users\<ユーザー名>.platformio\packages\framework-arduinoespressif32\libraries\DNSServer\library.properties file Found 28 compatible libraries Scanning dependencies... Dependency Graph |-- <HttpClient> 2.2.0 |-- <M5Stack> 0.2.9 | |-- <FS> 1.0 | |-- <SPIFFS> 1.0 | | |-- <FS> 1.0 | |-- <SPI> 1.0 | |-- <HttpClient> 2.2.0 | |-- <Wire> 1.0.1 | |-- <SD(esp32)> 1.0.5 | | |-- <FS> 1.0 | | |-- <SPI> 1.0 Building in release mode Compiling .pio\build\m5stack-grey\src\main.cpp.o Compiling .pio\build\m5stack-grey\lib45e\M5Stack_ID1851\M5Display.cpp.o Compiling .pio\build\m5stack-grey\lib45e\M5Stack_ID1851\utility\SH200Q.cpp.o Compiling .pio\build\m5stack-grey\lib45e\M5Stack_ID1851\utility\Speaker.cpp.o Compiling .pio\build\m5stack-grey\lib45e\M5Stack_ID1851\utility\Sprite.cpp.o Compiling .pio\build\m5stack-grey\lib45e\M5Stack_ID1851\utility\pngle.c.o Compiling .pio\build\m5stack-grey\lib45e\M5Stack_ID1851\utility\qrcode.c.o Compiling .pio\build\m5stack-grey\lib45e\M5Stack_ID1851\utility\quaternionFilters.cpp.o src\main.cpp:4:1: error: 'HTTPClient' does not name a type HTTPClient http; ^ *** [.pio\build\m5stack-grey\src\main.cpp.o] Error 1 C:\Users\<ユーザー名>.platformio\lib\M5Stack_ID1851\src\M5Display.cpp: In member function 'void M5Display::drawPngUrl(const char*, uint16_t, uint16_t, uint16_t, uint16_t, uint16_t, uint16_t, double, uint8_t)': C:\Users\<ユーザー名>.platformio\lib\M5Stack_ID1851\src\M5Display.cpp:543:3: error: 'HTTPClient' was not declared in this scope HTTPClient http; ^ C:\Users\<ユーザー名>.platformio\lib\M5Stack_ID1851\src\M5Display.cpp:545:7: error: 'WiFi' was not declared in this scope if (WiFi.status() != WL_CONNECTED) { ^ C:\Users\<ユーザー名>.platformio\lib\M5Stack_ID1851\src\M5Display.cpp:545:24: error: 'WL_CONNECTED' was not declared in this scope if (WiFi.status() != WL_CONNECTED) { ^ C:\Users\<ユーザー名>.platformio\lib\M5Stack_ID1851\src\M5Display.cpp:550:3: error: 'http' was not declared in this scope http.begin(url); ^ C:\Users\<ユーザー名>.platformio\lib\M5Stack_ID1851\src\M5Display.cpp:553:19: error: 'HTTP_CODE_OK' was not declared in this scope if (httpCode != HTTP_CODE_OK) { ^ C:\Users\<ユーザー名>.platformio\lib\M5Stack_ID1851\src\M5Display.cpp:559:3: error: 'WiFiClient' was not declared in this scope WiFiClient *stream = http.getStreamPtr(); ^ C:\Users\<ユーザー名>.platformio\lib\M5Stack_ID1851\src\M5Display.cpp:559:15: error: 'stream' was not declared in this scope WiFiClient *stream = http.getStreamPtr(); ^ *** [.pio\build\m5stack-grey\lib45e\M5Stack_ID1851\M5Display.cpp.o] Error 1 ================================================== [FAILED] Took 6.85 seconds ================================================== ターミナルの処理が終了しました (終了コード: 1)
httpClientがなにか悪さをしているのでしょうが、調べてもなかなかヒントにたどり着けず...
ご回答宜しくお願い致します。

回答3件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。