PlatformIO /lib folder not working properly

Hello everyone,

I’ve been trying to add a library to my ep=sp-idf project (PubSubClient) in the simplest possible way without installing it with pio IDE. What I’m essentially doing is placing the PubSubClient folder with both sourcer files (.h and .cpp) inside the /lib folder of the pio project and including it in my main.cpp.

I’m getting a no such file or directory error when trying to build, which I find strange since I followed the documentation over: Redirecting...

Help is much apprecciated, thanks.

Ctrl+Shift+P → Rebuild IntelliSense.

Always build the project once and look for compiler errors before you believe VSCode’s crying "oh no can’t find header file :frowning: :frowning: :frowning: ". IntelliSense is updated after the build or with an explicit request.

1 Like

Hi @maxgerhardt ,

Thank you for the prompt reply.

I’m not sure what you mean by always building the project first, the error occurs precisely when trying to build it, right? Please let me know if my understanding is correct.

I’ll try do rebuild IntelliSense and post the result down below.

Edit1: After rebuilding IntelliSense index it still can’t find the header files, for now it seems to only find it when I place the file inside the include folder.

Edit2: After changing the platformio.ini lib_compat_mode to off it did recognize the PubSubClient as a lib, which does not have a manifest.json, I will further investigate if any other libs in my project ‘state’ that they are incompatible with PubSubClient.

Thanks

1 Like

Hello all,

Do you mind explaining to me why does this happen?

Many thanks,

Do you mean library.json?

Where is the full project?

Yes, that is what I meant.

The full project is in a devops repo, but I cannot disclose it fully due to it being proprietary source code, however, I can share the public libraries I intend to add to it, which are:

DNSServer
PubSubClient
ESPAsyncWebServer-esphome
EzTime
WebServer
Websockets

I believe most if not all of these are ‘standard’ Arduino libraries, that I’m adding to a ESP-IDF project using Arduino as a component.

One issue I can see is that esp_http_client idf component conflicts with some Wi-Fi/internet libraries from Arduino, I think I should open a new topic for that.

Can you reproduce thet issue in a separate minimal project and post that?

1 Like

Sure, I will reproduce that issue in a minimal project and post that on Github, then I’ll edit this message with the repo URL.

Edit1: I have cloned your pio-espidf-ota-example repo and reproduced the issue at : GitHub - GKFernandes/pio-espidf-esp-http-client-issue: Minimalist repo to show esp-idf esp-http-client conflict with project library header files

Edit2: It seems a similar issue is happening over here:Conflicts with Webserver.h on some HTTP declarations · Issue #2 · Pedroalbuquerque/ESP32WebServer · GitHub

Edit3: The problem seems a little bit clearer now, it seems to be a difference on how the number that corresponds to the HTTP method is represented, not sure on how to solve it though, the image below shows the error:

Tks,

I know this is far from an ideal solution, but the plan now is to replace ESPAsyncWebServer.h HTTP methods for HTTPESP methods, for example, use some find and replace commands to change HTTP_GET to HTTP_GETESP just as a proof of concept, I will do that and post the results later.