Issue with the "lib" folder

I must be missing something. I’ve created a folder in “lib”, add my files, but the compiler doesn’t find them. Everything is on this screenshot (right-click, then “Open image in new tab”): my lib folder on the left, my code in the middle and the error message at the bottom.


Any clue?

(P.S.: I’ve already used the Clean command and deleted the .pio folder)

The folder structures and names look all OK. I’d nitpick a missing #include <Arduino.h> at the top but it should work without it if you include it in that header.

Can you upload the full project?

Sorry, the issue is gone. I had included the library though a lib_deps github link to make it work. When I saw your answer above, I put the project back in place with the lib folder, but now it compiles without any problem.

I now feel an urgent need to share my general feeling, as I spent almost an hour on this: I started using PlatformIO a few days ago and so far the journey has been very frustrating. I keep having random issues, I still cannot understand how to compile the right project in my workspace (and, yes, I know about the baroque button “Switch Project Environment”), I keep having cache problems up to the point that I delete the .pio folder every ten minutes, and I still cannot efficiently locate warning and errors from the Terminal (as they are either hidden far up away or unclickable).

Now for a final joke: I can change the #include line to whatever I want and it successfully compiles!
I will not try to investigate this, as it will magically solve itself in 10 to 60 minutes.

Sorry for being bitter to you, @maxgerhardt, as you been very available and helpful. I will check PlatformIO again in a few months (well, probably sooner, as your competitors are terrible!). Keep up the good work and don’t let the moaners distract you! :slight_smile:

The filename path of the main.cpp says test_GX-91 - SPI\src\main.cpp but the actively selected project, as seen in the bottom taskbar and in the workspace explorer on the left is a project called test_lib – you are editing a file of one project but compiling another one and it’s unaffected.

Yes, it’s happened several times in the past few days, I don’t understand why. I can’t seem to manage opened files in the editor with PlatformIO. I’ve just done six straight years of full-time web development with VS code, and this problem never occurred. It might be linked to the fact that I’m forced to keep only one project in the workspace, leading to a lot of back and forth file operations. Or to the fact that I constantly have to quit and relaunch VSCode, as platformio doesn’t seem to recognize cloned projects at the first launch (even if you delete the PIO folder). Or simply to the fact that my head is clouded by paranoia with all the random issues.

Why’s that? I have multiple workspaces too and it works for me. If there are IntelliSense issues I do a Ctrl+Shift+P → RebuildIntelliSense, much much quicker than deleting .vscode, and the “Clean” task cleans your .pio\build folder.