Including libs: File not found

A week ago or so, I was trying to do a project, and included libraries via the Platform.io VSC GUI, which didn’t work. I got back to it today, and looked into it

Whenever I try to compile any project that uses libraries, it fails the same way: It can’t find the library

Compiling .pio/build/esp32dev/app_trace/app_trace_util.o
src/main.c:19:10: fatal error: ESPAsyncWebServer.h: No such file or directory

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

 #include <ESPAsyncWebServer.h>
          ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.

The library is correctly integrated into the project:

[env:esp32dev]
platform = espressif32
board = esp32dev
framework = espidf
lib_deps = ottowinter/ESPAsyncWebServer-esphome@^3.0.0

Which is the first thing I always find would be an issue (when I searched for example here)
I would think PIO would do all the things with compilers to make the compiler go brrrr

It also exists in the folder at (probably, idk) the right location

I created a test project, just adding and including the library, it doesn’t work

Furthermore, I cloned a project from Github a bit ago and it didn’t work, it would fail at including the Configuration.h, but I thought that was just the creator doing something wrong somewhere and I didn’t care to investigate. Makes me think I’m actually doing something wrong tho…

I also looked at a few things, like (I accidentially pressed Ctrl Enter fu-)

gcc --version
gcc (GCC) 12.1.0
Copyright (C) 2022 Free Software Foundation, Inc.

which gcc
/usr/bin/gcc

so that might be an issue, I have nearly no experience with compilers

I am lost, I can’t find anyone being as much an idiot at this as I am

PlatformIO reufses to include this library in the compatibility-check stage because the library only declares compatibility with the Arduino framework, on which it primarily depends.

ESPAsyncWebServer/src/ESPAsyncWebServer.h at master · esphome/ESPAsyncWebServer · GitHub.

Either switch your project to framework = arduino, or, add in Arduino as an ESP-IDF component as shown in the official example.

If you don’t know what ESP-IDF is, you very likely want to start a beginner-friendly Arduino project instead of using the more complicate native SDK. Just create a new project for your ESP32 and select Arduino as framework in the project creation and close your old project.

Read the include files carefully. There is a CredentialsTemplate.h which tells you how to create the Credentials.h from it to make the project compile.

Oh Thanks… I wasn’t aware PIO would allow you to install a lib using another framework, that was stupid from my side, I just didn’t check the framework

Thanks, I guess I didn’t notice other files weren’t importing either… I mean, now it’s failing elsewhere, but that seems to be a common issue with the lib so it should be fixable lol

Thanks! :smiley:

Indeed, the

C:\Users\Max\temp\slidertron/.pio/libdeps/esp32doit-devkit-v1/ESP Async WebServer/src/WebAuthentication.cpp:73: undefined reference to `mbedtls_md5_starts’

can be fixed by exchanging the lip_deps in the platformio.ini to

lib_deps =
   ayushsharma82/AsyncElegantOTA@^2.2.7
   ottowinter/ESPAsyncWebServer-esphome@^3.0.0
   links2004/WebSockets@^2.3.7