PlatformIO undefined reference to library

I am making my own .cpp and .h files in /include folder, putting the declarations in .h files and definitions in .cpp files.

Here is the folder structure

- include
   |- filters
       |- lowpass_filter.h 
       |- lowpass_filter.cpp
       |- bandpass_filter.h 
       |- bandpass_filter.cpp
   |- board.h
   |- power.h
   |- power.cpp

VS Code intellisense detects those .cpp files easily.

But when I compile, it says undefined reference. When I put the definitions in .h files as well, and remove .cpp files, it works perfectly.

Is there a fix for that?

And in which folder are those files? They must be in src/ or in a new folder in lib/.

Yes, they are in lib/

Did you follow the documented folderstructure of

- lib
   |- YourLibraryName
       |- LibraryFile.h 
       |- LibraryFile.cpp

or did you put them directly in lib (which is wrong)?

Okay I just checked, they are in include folder, not lib.
This is the structure

- include
   |- filters
       |- lowpass_filter.h 
       |- lowpass_filter.cpp
       |- bandpass_filter.h 
       |- bandpass_filter.cpp
   |- board.h
   |- power.h
   |- power.cpp

It has the files placed both the wrong and right ways. Both do not work.

Edit:
Even after putting the .h and .cpp files in relevant folders like you suggested, it gives the same error. And by the way Iā€™m trying to compile for an ESP32, if that matters.

Files in include/ are not compiled ā€“ try moving everything from include/ in src/.