PlatformIO Community

Libraries are too frustrating

I came into this with half as much knowledge as I should have had, but I’m pretty quick.

I thought PlatforrmIO used an online database of libraries, and that’s why it was so frustrating- there was no way to get my libraries into the system.
I included my libraries folder in the .ini file, trying to get my libraries recognized. I added libraries as lib_dep.
Now, all of my libraries are in the PlatformIO /lib folder, and PlatformIO still fails to recognize them.

What is it that you engineer-typists don’t tell people? I should have seen everything obvious by now.

I mean, ‘Arduino.h’ has to be one of the most commonly used libraries, and PlatformIO won’t use it?Libraries1

I’m looking at something and I know it’s not what I’m seeing. What the heck?

  1. Does it compile?
  2. Have you rebuilt the IntelliSense Index?
  3. If none of that work we need to see a fully reproducible example (project folder).

1- Of course it doesn’t compile. These are the errors:

Archiving .pio\build\esp32doit-devkit-v1\libd29\libArduino.a
Compiling .pio\build\esp32doit-devkit-v1\lib06a\Wire\Wire.cpp.o
In file included from src\main.cpp:6:0:
C:/Users/joema/.platformio/lib/Arduino/Arduino.h:31:3: error: stray '\302' in program
   <title>ArduinoCore-avr/Arduino.h at master · arduino/ArduinoCore-avr</title>
   ^
C:/Users/joema/.platformio/lib/Arduino/Arduino.h:31:3: error: stray '\267' in program
Compiling .pio\build\esp32doit-devkit-v1\lib4f7\SPI\SPI.cpp.o
In file included from src\main.cpp:6:0:
C:/Users/joema/.platformio/lib/Arduino/Arduino.h:158:10: warning: missing terminating ' character
     <!-- '"` --><!-- </textarea></xmp> --></option></form><form class="js-site-search-form" role="search" aria-label="Site" data-scope-type="Repository" data-scope-id="103147930" data-scoped-search-url="/arduino/ArduinoCore-avr/search" data-unscoped-search-url="/search" action="/arduino/ArduinoCore-avr/search" accept-charset="UTF-8" method="get">
          ^
C:/Users/joema/.platformio/lib/Arduino/Arduino.h:158:5: error: missing terminating ' character
     <!-- '"` --><!-- </textarea></xmp> --></option></form><form class="js-site-search-form" role="search" aria-label="Site" data-scope-type="Repository" data-scope-id="103147930" data-scoped-search-url="/arduino/ArduinoCore-avr/search" data-unscoped-search-url="/search" action="/arduino/ArduinoCore-avr/search" accept-charset="UTF-8" method="get">
     ^
In file included from src\main.cpp:6:0:
C:/Users/joema/.platformio/lib/Arduino/Arduino.h:205:7: error: stray '\342' in program
       <span aria-hidden="true" class="d-inline-block ml-1 v-align-middle">↵</span>
       ^
C:/Users/joema/.platformio/lib/Arduino/Arduino.h:205:7: error: stray '\206' in program
C:/Users/joema/.platformio/lib/Arduino/Arduino.h:205:7: error: stray '\265' in program
C:/Users/joema/.platformio/lib/Arduino/Arduino.h:210:7: error: stray '\342' in program
       <span class="d-inline-block ml-1 v-align-middle">↵</span>
       ^
C:/Users/joema/.platformio/lib/Arduino/Arduino.h:210:7: error: stray '\206' in program
C:/Users/joema/.platformio/lib/Arduino/Arduino.h:210:7: error: stray '\265' in program
In file included from src\main.cpp:6:0:
C:/Users/joema/.platformio/lib/Arduino/Arduino.h:246:7: error: stray '\342' in program
       <span aria-hidden="true" class="d-inline-block ml-1 v-align-middle">↵</span>
       ^
C:/Users/joema/.platformio/lib/Arduino/Arduino.h:246:7: error: stray '\206' in program
C:/Users/joema/.platformio/lib/Arduino/Arduino.h:246:7: error: stray '\265' in program
C:/Users/joema/.platformio/lib/Arduino/Arduino.h:251:7: error: stray '\342' in program
       <span class="d-inline-block ml-1 v-align-middle">↵</span>
       ^
C:/Users/joema/.platformio/lib/Arduino/Arduino.h:251:7: error: stray '\206' in program
C:/Users/joema/.platformio/lib/Arduino/Arduino.h:251:7: error: stray '\265' in program
In file included from src\main.cpp:6:0:
C:/Users/joema/.platformio/lib/Arduino/Arduino.h:278:7: error: stray '\342' in program
       <span aria-hidden="true" class="d-inline-block ml-1 v-align-middle">↵</span>
       ^
C:/Users/joema/.platformio/lib/Arduino/Arduino.h:278:7: error: stray '\206' in program
C:/Users/joema/.platformio/lib/Arduino/Arduino.h:278:7: error: stray '\265' in program
C:/Users/joema/.platformio/lib/Arduino/Arduino.h:283:7: error: stray '\342' in program
       <span class="d-inline-block ml-1 v-align-middle">↵</span>
       ^
C:/Users/joema/.platformio/lib/Arduino/Arduino.h:283:7: error: stray '\206' in program
C:/Users/joema/.platformio/lib/Arduino/Arduino.h:283:7: error: stray '\265' in program
C:/Users/joema/.platformio/lib/Arduino/Arduino.h:327:10: warning: missing terminating ' character
     <!-- '"` --><!-- </textarea></xmp> --></option></form><form action="/logout" accept-charset="UTF-8" method="post"><input type="hidden" name="authenticity_token" value="nmZpZf1Ko4vMz5oqhVb6vYg2Oy202KhfN1IKjreF0440WY4/9AsfpOiiVG24aYQdUislb5MAh7ih2bejH1Jaew==" />
          ^
C:/Users/joema/.platformio/lib/Arduino/Arduino.h:327:5: error: missing terminating ' character
     <!-- '"` --><!-- </textarea></xmp> --></option></form><form action="/logout" accept-charset="UTF-8" method="post"><input type="hidden" name="authenticity_token" value="nmZpZf1Ko4vMz5oqhVb6vYg2Oy202KhfN1IKjreF0440WY4/9AsfpOiiVG24aYQdUislb5MAh7ih2bejH1Jaew==" />
     ^
In file included from src\main.cpp:6:0:
C:/Users/joema/.platformio/lib/Arduino/Arduino.h:427:20: warning: missing terminating " character
         <div class="
                    ^
Exception in thread Thread-3:
Traceback (most recent call last):
  File "C:\Users\joema\.platformio\python37\lib\threading.py", line 926, in _bootstrap_inner
    self.run()
  File "C:\Users\joema\.platformio\python37\lib\threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\joema\.platformio\penv\lib\site-packages\platformio\proc.py", line 46, in run
    self.do_reading()
  File "C:\Users\joema\.platformio\penv\lib\site-packages\platformio\proc.py", line 69, in do_reading
    for byte in iter(lambda: self._pipe_reader.read(1), ""):
  File "C:\Users\joema\.platformio\penv\lib\site-packages\platformio\proc.py", line 69, in <lambda>
    for byte in iter(lambda: self._pipe_reader.read(1), ""):
  File "C:\Users\joema\.platformio\python37\lib\encodings\cp1252.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x8f in position 2969: character maps to <undefined>

Compiling .pio\build\esp32doit-devkit-v1\libf3c\Adafruit BusIO\Adafruit_BusIO_Register.cpp.o

2- Have you rebuilt the IntelliSense Index?
I don’t know what that is, but it sounds like something I should understand.

Libraries2

INI below. I no longer add the ‘extra dirs’ line. I’m adding new libraries to the PlatformIO /lib in Users.

; PlatformIO Project Configuration File

;

;   Build options: build flags, source filter

;   Upload options: custom upload port, speed and extra flags

;   Library options: dependencies, extra library storages

;   Advanced options: extra scripting

;

; Please visit documentation for the other options and examples

; https://docs.platformio.org/page/projectconf.html

[env:esp32doit-devkit-v1]

platform = espressif32

board = esp32doit-devkit-v1

framework = arduino

lib_extra_dirs = ${sysenv.HOMEDRIVE}${sysenv.HOMEPATH}\Documents\libraries

Please remove this C:/Users/joema/.platformio/lib/Arduino/ folder. It seems to contain… HTML content? o_O

Also the first post I posted contained a blue link which shows you where the button is in VSCode for the IntelliSense rebuild. But the real problem is as described in the problem above

Crazy. Did I get the whole page instead of the .h file??

I don’t think this is a system issue as much as I think you need to spend some more time learning how C/C++ works. You are linking HTML in it appears, which is bound to break. Please don’t come in angry at the framework when you acknowledge that you have a knowledge gap. The team here has done a wonderful job especially considering it is free. We are happy to help but please be mindful of the community and where you are approaching it from.