m5stack / M5Dial

58 stars 13 forks source link

Wire.h: No such file or directory #19

Closed ktetsuo closed 1 week ago

ktetsuo commented 2 weeks ago

I get a build error when using platform.io.

In file included from .pio/libdeps/m5stack-stamps3/M5Dial/src/M5Dial.h:7,
                 from .pio/libdeps/m5stack-stamps3/M5Dial/src/M5Dial.cpp:1:
.pio/libdeps/m5stack-stamps3/M5Dial/src/utility/MFRC522.h:83:10: fatal error: Wire.h: No such file or directory

 #include <Wire.h>
          ^~~~~~~~
compilation terminated.
In file included from .pio/libdeps/m5stack-stamps3/M5Dial/src/utility/MFRC522.cpp:10:
.pio/libdeps/m5stack-stamps3/M5Dial/src/utility/MFRC522.h:83:10: fatal error: Wire.h: No such file or directory

platformio.ini:

[env:m5stack-stamps3]
platform = espressif32
board = m5stack-stamps3
framework = arduino
lib_deps = 
    m5stack/M5Dial@^1.0.2
    m5stack/M5Unified@^0.1.16
ktetsuo commented 2 weeks ago

Commenting out #include <Wire.h>, then the build succeeded. Wire.h seems unnecessary.

src\utility\MFRC522.h

#ifndef MFRC522_h
#define MFRC522_h

#include "M5Unified.h"
#include <Arduino.h>
- #include <Wire.h>
+ //#include <Wire.h>

src\utility\MFRC522.cpp

#include <Arduino.h>
#include "MFRC522.h"
- #include <Wire.h>
+ //#include <Wire.h>

using namespace m5;
Tinyu-Zhao commented 2 weeks ago

I can't reproduce, can you prove more information.

image
ktetsuo commented 1 week ago

I solved by myself.

It is neccesary to add Wire to lib_deps. https://community.platformio.org/t/wire-h-not-found-platformio-latest-version/2046

After adding lib_deps = Wire, the build succeeded.

[env:m5stack-stamps3]
platform = espressif32
board = m5stack-stamps3
framework = arduino
lib_deps = 
    m5stack/M5Dial@^1.0.2
    m5stack/M5Unified@^0.1.16
+   Wire