Insane from this bad library function

EVERY TIME.

EVERY TIME I TRY TO WORK IN THE ARDUINO FRAMEWORK PIO REFUSES TO LET ME until I shed blood and complain to the PIO Community.

Someone has to know why Arduino.h gives me trouble EVERY STINKING TIME.

Of course, the others are in the folder too.

I do not like what PIO does with libraries. This is the ‘figuring out what to do with these libraries’ show. I’m supposed to be spending my time being frustrated with my illiteracy, not the tools.

Moderator edit: Once again, please USE CODE FORMATTING when posting logs or code.

Processing esp32doit-devkit-v1 (platform: espressif32; board: esp32doit-devkit-v1; framework: arduino)
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32doit-devkit-v1.html
PLATFORM: Espressif 32 1.12.4 > DOIT ESP32 DEVKIT V1
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB 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:
 - framework-arduinoespressif32 3.10004.200129 (1.0.4) 
 - tool-esptoolpy 1.20600.0 (2.6.0)
 - tool-mkspiffs 2.230.0 (2.30)
 - toolchain-xtensa32 2.50200.80 (5.2.0)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 229 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <SPI> 1.0
|-- <Wire>
Building in release mode
Compiling .pio\build\esp32doit-devkit-v1\src\main.cpp.o
Generating partitions .pio\build\esp32doit-devkit-v1\partitions.bin
Compiling .pio\build\esp32doit-devkit-v1\lib4f7\SPI\SPI.cpp.o
Compiling .pio\build\esp32doit-devkit-v1\lib8e1\Wire\Wire.cpp.o
Archiving .pio\build\esp32doit-devkit-v1\libFrameworkArduinoVariant.a
C:\Users\joema\Documents\libraries\Wire\Wire.cpp:27:17: fatal error: twi.h: No such file or directory

*************************************************************
* Looking for twi.h dependency? Check our library registry!
*
* CLI  > platformio lib search "header:twi.h"
* Web  > https://platformio.org/lib/search?query=header:twi.h
*
*************************************************************

compilation terminated.
Compiling .pio\build\esp32doit-devkit-v1\FrameworkArduino\Esp.cpp.o
*** [.pio\build\esp32doit-devkit-v1\lib8e1\Wire\Wire.cpp.o] Error 1
In file included from src\main.cpp:23:0:
C:\Users\joema\Documents\libraries\SPI/SPI.h:30:0: warning: "SPI_HAS_TRANSACTION" redefined
 #define SPI_HAS_TRANSACTION 1
 ^
In file included from C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/esp32-hal.h:57:0,
                 from C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/Arduino.h:35,
                 from src\main.cpp:22:
C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/esp32-hal-spi.h:25:0: note: this is the location of the previous definition
 #define SPI_HAS_TRANSACTION
 ^
In file included from src\main.cpp:23:0:
C:\Users\joema\Documents\libraries\SPI/SPI.h:51:0: warning: "SPI_MODE0" redefined
 #define SPI_MODE0 0x00
 ^
In file included from C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/esp32-hal.h:57:0,
                 from C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/Arduino.h:35,
                 from src\main.cpp:22:
C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/esp32-hal-spi.h:41:0: note: this is the location of the previous definition
 #define SPI_MODE0 0
 ^
In file included from src\main.cpp:23:0:
C:\Users\joema\Documents\libraries\SPI/SPI.h:52:0: warning: "SPI_MODE1" redefined
 #define SPI_MODE1 0x04
 ^
In file included from C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/esp32-hal.h:57:0,
                 from C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/Arduino.h:35,
                 from src\main.cpp:22:
C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/esp32-hal-spi.h:42:0: note: this is the location of the previous definition
 #define SPI_MODE1 1
 ^
In file included from src\main.cpp:23:0:
C:\Users\joema\Documents\libraries\SPI/SPI.h:53:0: warning: "SPI_MODE2" redefined
 #define SPI_MODE2 0x08
 ^
In file included from C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/esp32-hal.h:57:0,
                 from C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/Arduino.h:35,
                 from src\main.cpp:22:
C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/esp32-hal-spi.h:43:0: note: this is the location of the previous definition
 #define SPI_MODE2 2
 ^
In file included from src\main.cpp:23:0:
C:\Users\joema\Documents\libraries\SPI/SPI.h:54:0: warning: "SPI_MODE3" redefined
 #define SPI_MODE3 0x0C
 ^
In file included from C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/esp32-hal.h:57:0,
                 from C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/Arduino.h:35,
                 from src\main.cpp:22:
C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/esp32-hal-spi.h:44:0: note: this is the location of the previous definition
 #define SPI_MODE3 3
 ^
In file included from src\main.cpp:23:0:
C:\Users\joema\Documents\libraries\SPI/SPI.h:56:0: warning: "SPI_CLOCK_DIV4" redefined
 #define SPI_CLOCK_DIV4 0x00
 ^
In file included from C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/esp32-hal.h:57:0,
                 from C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/Arduino.h:35,
                 from src\main.cpp:22:
C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/esp32-hal-spi.h:34:0: note: this is the location of the previous definition
 #define SPI_CLOCK_DIV4    0x00241001 //4 MHz
 ^
In file included from src\main.cpp:23:0:
C:\Users\joema\Documents\libraries\SPI/SPI.h:57:0: warning: "SPI_CLOCK_DIV16" redefined
 #define SPI_CLOCK_DIV16 0x01
 ^
In file included from C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/esp32-hal.h:57:0,
                 from C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/Arduino.h:35,
                 from src\main.cpp:22:
C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/esp32-hal-spi.h:36:0: note: this is the location of the previous definition
 #define SPI_CLOCK_DIV16   0x009c1001 //1 MHz
 ^
In file included from src\main.cpp:23:0:
C:\Users\joema\Documents\libraries\SPI/SPI.h:58:0: warning: "SPI_CLOCK_DIV64" redefined
 #define SPI_CLOCK_DIV64 0x02
 ^
In file included from C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/esp32-hal.h:57:0,
                 from C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/Arduino.h:35,
                 from src\main.cpp:22:
C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/esp32-hal-spi.h:38:0: note: this is the location of the previous definition
 #define SPI_CLOCK_DIV64   0x027c1001 //250 KHz
 ^
In file included from src\main.cpp:23:0:
C:\Users\joema\Documents\libraries\SPI/SPI.h:59:0: warning: "SPI_CLOCK_DIV128" redefined
 #define SPI_CLOCK_DIV128 0x03
 ^
In file included from C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/esp32-hal.h:57:0,
                 from C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/Arduino.h:35,
                 from src\main.cpp:22:
C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/esp32-hal-spi.h:39:0: note: this is the location of the previous definition
 #define SPI_CLOCK_DIV128  0x04fc1001 //125 KHz
 ^
In file included from src\main.cpp:23:0:
C:\Users\joema\Documents\libraries\SPI/SPI.h:60:0: warning: "SPI_CLOCK_DIV2" redefined
 #define SPI_CLOCK_DIV2 0x04
 ^
In file included from C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/esp32-hal.h:57:0,
                 from C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/Arduino.h:35,
                 from src\main.cpp:22:
C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/esp32-hal-spi.h:33:0: note: this is the location of the previous definition
 #define SPI_CLOCK_DIV2    0x00101001 //8 MHz
 ^
In file included from src\main.cpp:23:0:
C:\Users\joema\Documents\libraries\SPI/SPI.h:61:0: warning: "SPI_CLOCK_DIV8" redefined
 #define SPI_CLOCK_DIV8 0x05
 ^
In file included from C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/esp32-hal.h:57:0,
                 from C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/Arduino.h:35,
                 from src\main.cpp:22:
C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/esp32-hal-spi.h:35:0: note: this is the location of the previous definition
 #define SPI_CLOCK_DIV8    0x004c1001 //2 MHz
 ^
In file included from src\main.cpp:23:0:
C:\Users\joema\Documents\libraries\SPI/SPI.h:62:0: warning: "SPI_CLOCK_DIV32" redefined
 #define SPI_CLOCK_DIV32 0x06
 ^
In file included from C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/esp32-hal.h:57:0,
                 from C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/Arduino.h:35,
                 from src\main.cpp:22:
C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/esp32-hal-spi.h:37:0: note: this is the location of the previous definition
 #define SPI_CLOCK_DIV32   0x013c1001 //500 KHz
 ^
In file included from src\main.cpp:24:0:
C:\Users\joema\Documents\libraries\Wire/Wire.h:2:1: error: stray '\342' in program
 Search or jump to…
 ^
C:\Users\joema\Documents\libraries\Wire/Wire.h:2:1: error: stray '\200' in program
C:\Users\joema\Documents\libraries\Wire/Wire.h:2:1: error: stray '\246' in program
C:\Users\joema\Documents\libraries\Wire/Wire.h:9:1: error: stray '@' in program
 @MonsterThews 
 ^
C:\Users\joema\Documents\libraries\Wire/Wire.h:11:1: error: stray '\342' in program
 Using the Hello World guide, you’ll start a branch, write comments, and open a pull request.
 ^
C:\Users\joema\Documents\libraries\Wire/Wire.h:11:1: error: stray '\200' in program
C:\Users\joema\Documents\libraries\Wire/Wire.h:11:1: error: stray '\231' in program
C:\Users\joema\Documents\libraries\Wire/Wire.h:31:1: error: stray '@' in program
 @earlephilhower
 ^
C:\Users\joema\Documents\libraries\Wire/Wire.h:32:69: error: stray '#' in program
 earlephilhower Reduce the IRAM usage of I2C code by 600-1500 bytes (#6326)
                                                                     ^
C:\Users\joema\Documents\libraries\Wire/Wire.h:33:1: error: stray '\342' in program
 …
 ^
C:\Users\joema\Documents\libraries\Wire/Wire.h:33:1: error: stray '\200' in program
C:\Users\joema\Documents\libraries\Wire/Wire.h:33:1: error: stray '\246' in program
C:\Users\joema\Documents\libraries\Wire/Wire.h:37:1: error: stray '@' in program
 @igrr@earlephilhower@devyte@d-a-v@dave-prosee@everslick@carlsa
 ^
C:\Users\joema\Documents\libraries\Wire/Wire.h:37:6: error: stray '@' in program
 @igrr@earlephilhower@devyte@d-a-v@dave-prosee@everslick@carlsa
      ^
C:\Users\joema\Documents\libraries\Wire/Wire.h:37:21: error: stray '@' in program
 @igrr@earlephilhower@devyte@d-a-v@dave-prosee@everslick@carlsa
                     ^
C:\Users\joema\Documents\libraries\Wire/Wire.h:37:28: error: stray '@' in program
 @igrr@earlephilhower@devyte@d-a-v@dave-prosee@everslick@carlsa
                            ^
C:\Users\joema\Documents\libraries\Wire/Wire.h:37:34: error: stray '@' in program
 @igrr@earlephilhower@devyte@d-a-v@dave-prosee@everslick@carlsa
                                  ^
C:\Users\joema\Documents\libraries\Wire/Wire.h:37:46: error: stray '@' in program
 @igrr@earlephilhower@devyte@d-a-v@dave-prosee@everslick@carlsa
                                              ^
C:\Users\joema\Documents\libraries\Wire/Wire.h:37:56: error: stray '@' in program
 @igrr@earlephilhower@devyte@d-a-v@dave-prosee@everslick@carlsa
                                                        ^
C:\Users\joema\Documents\libraries\Wire/Wire.h:127:1: error: stray '\302' in program
 © 2020 GitHub, Inc.
 ^
C:\Users\joema\Documents\libraries\Wire/Wire.h:127:1: error: stray '\251' in program
In file included from C:\Users\joema\Documents\libraries\SPI\SPI.cpp:11:0:
C:\Users\joema\Documents\libraries\SPI\SPI.h:30:0: warning: "SPI_HAS_TRANSACTION" redefined
 #define SPI_HAS_TRANSACTION 1
 ^
In file included from C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/esp32-hal.h:57:0,
                 from C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/Arduino.h:35,
                 from C:\Users\joema\Documents\libraries\SPI\SPI.h:16,
                 from C:\Users\joema\Documents\libraries\SPI\SPI.cpp:11:
C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/esp32-hal-spi.h:25:0: note: this is the location of the previous definition
 #define SPI_HAS_TRANSACTION
 ^
In file included from C:\Users\joema\Documents\libraries\SPI\SPI.cpp:11:0:
C:\Users\joema\Documents\libraries\SPI\SPI.h:51:0: warning: "SPI_MODE0" redefined
 #define SPI_MODE0 0x00
 ^
In file included from C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/esp32-hal.h:57:0,
                 from C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/Arduino.h:35,
                 from C:\Users\joema\Documents\libraries\SPI\SPI.h:16,
                 from C:\Users\joema\Documents\libraries\SPI\SPI.cpp:11:
C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/esp32-hal-spi.h:41:0: note: this is the location of the previous definition
 #define SPI_MODE0 0
 ^
In file included from C:\Users\joema\Documents\libraries\SPI\SPI.cpp:11:0:
C:\Users\joema\Documents\libraries\SPI\SPI.h:52:0: warning: "SPI_MODE1" redefined
 #define SPI_MODE1 0x04
 ^
In file included from C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/esp32-hal.h:57:0,
                 from C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/Arduino.h:35,
                 from C:\Users\joema\Documents\libraries\SPI\SPI.h:16,
                 from C:\Users\joema\Documents\libraries\SPI\SPI.cpp:11:
C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/esp32-hal-spi.h:42:0: note: this is the location of the previous definition
 #define SPI_MODE1 1
 ^
In file included from C:\Users\joema\Documents\libraries\SPI\SPI.cpp:11:0:
C:\Users\joema\Documents\libraries\SPI\SPI.h:53:0: warning: "SPI_MODE2" redefined
 #define SPI_MODE2 0x08
 ^
In file included from C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/esp32-hal.h:57:0,
                 from C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/Arduino.h:35,
                 from C:\Users\joema\Documents\libraries\SPI\SPI.h:16,
                 from C:\Users\joema\Documents\libraries\SPI\SPI.cpp:11:
C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/esp32-hal-spi.h:43:0: note: this is the location of the previous definition
 #define SPI_MODE2 2
 ^
In file included from C:\Users\joema\Documents\libraries\SPI\SPI.cpp:11:0:
C:\Users\joema\Documents\libraries\SPI\SPI.h:54:0: warning: "SPI_MODE3" redefined
 #define SPI_MODE3 0x0C
 ^
In file included from C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/esp32-hal.h:57:0,
                 from C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/Arduino.h:35,
                 from C:\Users\joema\Documents\libraries\SPI\SPI.h:16,
                 from C:\Users\joema\Documents\libraries\SPI\SPI.cpp:11:
C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/esp32-hal-spi.h:44:0: note: this is the location of the previous definition
 #define SPI_MODE3 3
 ^
In file included from C:\Users\joema\Documents\libraries\SPI\SPI.cpp:11:0:
C:\Users\joema\Documents\libraries\SPI\SPI.h:56:0: warning: "SPI_CLOCK_DIV4" redefined
 #define SPI_CLOCK_DIV4 0x00
 ^
In file included from C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/esp32-hal.h:57:0,
                 from C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/Arduino.h:35,
                 from C:\Users\joema\Documents\libraries\SPI\SPI.h:16,
                 from C:\Users\joema\Documents\libraries\SPI\SPI.cpp:11:
C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/esp32-hal-spi.h:34:0: note: this is the location of the previous definition
 #define SPI_CLOCK_DIV4    0x00241001 //4 MHz
 ^
In file included from C:\Users\joema\Documents\libraries\SPI\SPI.cpp:11:0:
C:\Users\joema\Documents\libraries\SPI\SPI.h:57:0: warning: "SPI_CLOCK_DIV16" redefined
 #define SPI_CLOCK_DIV16 0x01
 ^
In file included from C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/esp32-hal.h:57:0,
                 from C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/Arduino.h:35,
                 from C:\Users\joema\Documents\libraries\SPI\SPI.h:16,
                 from C:\Users\joema\Documents\libraries\SPI\SPI.cpp:11:
C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/esp32-hal-spi.h:36:0: note: this is the location of the previous definition
 #define SPI_CLOCK_DIV16   0x009c1001 //1 MHz
 ^
In file included from C:\Users\joema\Documents\libraries\SPI\SPI.cpp:11:0:
C:\Users\joema\Documents\libraries\SPI\SPI.h:58:0: warning: "SPI_CLOCK_DIV64" redefined
 #define SPI_CLOCK_DIV64 0x02
 ^
In file included from C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/esp32-hal.h:57:0,
                 from C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/Arduino.h:35,
                 from C:\Users\joema\Documents\libraries\SPI\SPI.h:16,
                 from C:\Users\joema\Documents\libraries\SPI\SPI.cpp:11:
C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/esp32-hal-spi.h:38:0: note: this is the location of the previous definition
 #define SPI_CLOCK_DIV64   0x027c1001 //250 KHz
 ^
In file included from C:\Users\joema\Documents\libraries\SPI\SPI.cpp:11:0:
C:\Users\joema\Documents\libraries\SPI\SPI.h:59:0: warning: "SPI_CLOCK_DIV128" redefined
 #define SPI_CLOCK_DIV128 0x03
 ^
In file included from C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/esp32-hal.h:57:0,
                 from C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/Arduino.h:35,
                 from C:\Users\joema\Documents\libraries\SPI\SPI.h:16,
                 from C:\Users\joema\Documents\libraries\SPI\SPI.cpp:11:
C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/esp32-hal-spi.h:39:0: note: this is the location of the previous definition
 #define SPI_CLOCK_DIV128  0x04fc1001 //125 KHz
 ^
In file included from C:\Users\joema\Documents\libraries\SPI\SPI.cpp:11:0:
C:\Users\joema\Documents\libraries\SPI\SPI.h:60:0: warning: "SPI_CLOCK_DIV2" redefined
 #define SPI_CLOCK_DIV2 0x04
 ^
In file included from C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/esp32-hal.h:57:0,
                 from C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/Arduino.h:35,
                 from C:\Users\joema\Documents\libraries\SPI\SPI.h:16,
                 from C:\Users\joema\Documents\libraries\SPI\SPI.cpp:11:
C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/esp32-hal-spi.h:33:0: note: this is the location of the previous definition
 #define SPI_CLOCK_DIV2    0x00101001 //8 MHz
 ^
In file included from C:\Users\joema\Documents\libraries\SPI\SPI.cpp:11:0:
C:\Users\joema\Documents\libraries\SPI\SPI.h:61:0: warning: "SPI_CLOCK_DIV8" redefined
 #define SPI_CLOCK_DIV8 0x05
 ^
In file included from C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/esp32-hal.h:57:0,
                 from C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/Arduino.h:35,
                 from C:\Users\joema\Documents\libraries\SPI\SPI.h:16,
                 from C:\Users\joema\Documents\libraries\SPI\SPI.cpp:11:
C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/esp32-hal-spi.h:35:0: note: this is the location of the previous definition
 #define SPI_CLOCK_DIV8    0x004c1001 //2 MHz
 ^
In file included from C:\Users\joema\Documents\libraries\SPI\SPI.cpp:11:0:
C:\Users\joema\Documents\libraries\SPI\SPI.h:62:0: warning: "SPI_CLOCK_DIV32" redefined
 #define SPI_CLOCK_DIV32 0x06
 ^
In file included from C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/esp32-hal.h:57:0,
                 from C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/Arduino.h:35,
                 from C:\Users\joema\Documents\libraries\SPI\SPI.h:16,
                 from C:\Users\joema\Documents\libraries\SPI\SPI.cpp:11:
C:\Users\joema\.platformio\packages\framework-arduinoespressif32\cores\esp32/esp32-hal-spi.h:37:0: note: this is the location of the previous definition
 #define SPI_CLOCK_DIV32   0x013c1001 //500 KHz
 ^
In file included from src\main.cpp:23:0:
C:\Users\joema\Documents\libraries\SPI/SPI.h:1398:8: error: 'SPIClass' does not name a type
 extern SPIClass SPI;
        ^
In file included from src\main.cpp:24:0:
C:\Users\joema\Documents\libraries\Wire/Wire.h:1:1: error: 'Skip' does not name a type
 Skip to content
 ^
C:\Users\joema\Documents\libraries\Wire/Wire.h:122:8: error: 'TwoWire' does not name a type
 extern TwoWire Wire;
        ^
C:\Users\joema\Documents\libraries\Wire/Wire.h:127:4: error: expected unqualified-id before numeric constant
 © 2020 GitHub, Inc.
    ^
src\main.cpp: In function 'void loop()':
src\main.cpp:39:9: error: 'baro' was not declared in this scope
   if (! baro.begin()) {
         ^
src\main.cpp:44:19: error: 'baro' was not declared in this scope
   float pascals = baro.getPressure();
                   ^
*** [.pio\build\esp32doit-devkit-v1\src\main.cpp.o] Error 1
In file included from C:\Users\joema\Documents\libraries\SPI\SPI.cpp:11:0:
C:\Users\joema\Documents\libraries\SPI\SPI.h:1398:8: error: 'SPIClass' does not name a type
 extern SPIClass SPI;
        ^
*** [.pio\build\esp32doit-devkit-v1\lib4f7\SPI\SPI.cpp.o] Error 1
========================================================================================= [FAILED]

This script worked. It worked on my DOIT ESP32 DevKit.

I saved it in a new project.

What is the solution? How am I supposed to deal with libraries? Is the lib folder empty or not? Do I use my own libraries folder? Does that work? If I specify it in the .ini file, is PIO going to use the libraries in my folders?

I don’t know if it works, or how it works if it does work.

I highly doubt that that code worked without any changes - Where was the #include <Adafruit_MPL3115A2.h>, since you are clearly trying to use code from it?

You need to tell PlatformIO that this project needs the Adafruit_MPL3115A2 library… e.g. lib_deps = Adafruit MPL3115A2 Library. Then you need to tell the compiler you are actually using that library (when you are using it)… e.g. #include <Adafruit_MPL3115A2.h> .

What was in your platformio.ini at the time that was not working? Without all the required information, it’s not really possible to help you.

In future, please post your platformio.ini file, the code used, and the build log. And use code formatting triple backticks to ensure it is readable by those you are asking for help! The library management in PlatformIO works just fine - I have been using it without any issue for over a year now (having migrated from the Arduino IDE), and I know many large multi-developer projects that use it, even commercially.

1 Like

Okay. Yes, I’m sure I did something to the file.

I thought I formatted it by deleting the extra lines. The edit window is narrow. I’ll spend more time on it next time.

But I don’t think it affects my central and unmoving question, which I think is captured well by the idiopathic squiggled Arduino.h.
I’ve been feeling like a nuisance, asking and asking, trying to come from the right angle to suddenly understand how libraries work in PIO.

There’s a lot going on, and I’ll never see or understand any of it. I’m astonished at the huge list of files packed in during compile.
But I can behave correctly as an input.

Why is Arduino.h squiggled every time I try to use it?
I’ve asked this question thirty times. Responses continue to clarify. I don’t think we NEED to know about the moving parts, but we do need to know how to push the button correctly.

It gets unsquiggled eventually, but it’s always squiggled before I delete the PIO folder and install the libraries and put them in the local /lib folder and the rest of the side activities that don’t seem like they should be happening.
It feels like I’m making extra work for myself (and y’all). It seems like someone who knows what they’re doing wouldn’t have this many moments of utter confusion doing something as stupid as including libraries.

Am I screwing something up that’s way upstream?

I’m learning C++. That’s going okay. But I’m not getting caught up on the “How we do things around here” stuff.

First off, it’s not a nuisance to be asking questions. :wink:

The squiggles are coming from something called “intellisense”. It’s badly named. It is not part of PlatformIO, but is probably part of some C++ plug-in you are using in your editor. Intellisense has problems! It’s fine when it works. It’s fubar when it doesn’t.

If you add a new header to your code,for example, until intellisence parses the header, or whatever, then anything using the features of that header will not be able to give you hints as to expected parameters etc. You will also see lots of squiggles.

Once parsed, the squiggles will go away.

I don’t pay any attention to intellisense squiggles!

I do look at the compiler error messages, after all, those are the important ones. Whatever you are doing in your pio and lib folders doesnt sound right to me.

When installing a library, the Arduino’s Servo library, for example, I do in my project folder:

pio lib install servo

nothing appears in the project’s lib folder. It does get written to the projects .pio/build/uno/ hierarchy somewhere. I don’t care where, I just use it in my codeby adding #include "servo.h" and that’s it. (The fact that my servo is not working properly is not a good thing!)

So, my advice is not to drop stuff willy nilly into the lib folder, unless it’s something like a class header and file, but to install the required libraries using the pio lib install ... command or the VSCode equivalent. As far as I’m concerned, I write into src, include and occasionally lib for my own stuff and install libraries using the correct tools.

HTH

Cheers,
Norm.

PS. If you wish, email me the zipped up project directory and I’ll take a look for you. It might help with the frustration. (Norman at dunbar-it dotco dotuk - you can work that out!)

1 Like

The squiggly lines can be quite confusing and trigger many questions in this forum.

Background

The squiggly lines are added by a feature called Intellisense. It’s part of the C/C++ extension of Visual Studio Code. For the most part, it works independently of the PlatformIO extension. So even if you have squiggly lines in the editor, your project might still build.

The most common case is that Intellisense cannot find certain header files. Very frequently if affects the first header file included at the top of your code, which happens to be Arduino.h – like in your case.

Do you have to live with it?

No, you don’t have to live with. Intellisense and the PlatformIO build task should be in sync and generate the same compiler errors. PlatformIO’s build task can generate additional errors such as linker errors (“undefined reference to…”) though.

How can Intellisense and PlatformIO be brought in sync?

  • If you have squiggly lines even though your code is likely correct, run PlatformIO’s Build task. If it builds without errors, PlatformIO and Intellisense are out of sync and you should continue with the tips below. If PlatformIO is unable to build your project, then focus on the errors in PlatformIO’s output and fix them before taking care of the squiggly lines.

  • If you add or remove a library or have not built your project for the first time, it is likely that Intellisense and PlatformIO are out of sync temporarily. To bring them in sync, first run PlatformIO’s Clean task and then the Build task. Among several steps, the Build task will download the needed libraries, likely the ones Intellisense is missing.

  • To locate the header files, Intellisense requires a list of paths and macro definitions. PlatformIO will generate them (see .vscode/c_cpp_properties.json). These paths and definitions are only effective if the project folder is open in Visual Studio Code and if the file was opened from the EXPLORER view in Visual Studio Code (it’s a bit more involved in reality but this is a good rule of thumb). So make sure that’s the case. If in doubt, close the file and reopen it from the EXPLORER view.

  • Intellisense can be a bit shaky at times, i.e. it gets stuck and stops working. So if the above tips are not sufficient to get rid of the squiggly lines – even though the project builds without errors – it usually helps to quit Visual Studio Code and start it again.

Additional Notes

  • Squiggly lines can in fact have two sources: Intellisense and PlatformIO build. The ones from Intellisense are red, the ones from PlatformIO are yellow. If you edit a file, Intellisense will update it squiggly lines after a few seconds. PlatformIO’s squiggly lines will be updated when you run Build the next time.

  • The PROBLEMS view in Visual Studio Code combines the errors from PlatformIO’s Build task and from Intellisense. So if in doubt, focus on PlatformIO’s output in the TERMINAL view and ignore the PROBLEMS view until you are sure that Intellisense and PlatformIO are in sync.

2 Likes

Do I type that in Terminal ?

1 Like

Thank you very much. When I saw the red squiggles, I assumed it was doomed.

It’s not clearly labeled- how many parts are there, and which ones are moving?

I do it in an external terminal session as I tend to use that over VSCodium. There is an option, as I remember, on the PlatformIO “screen” in VSCode to search for and install libraries, but the command will work in the VSCode terminal too.

Sorry, I’m not near my laptop at the moment, so the above is a bit vague. :frowning_face:

Cheers,
Norm.

1 Like

Thank you, I’ll use VSCode Terminal.