I am sorry to have to join the queue of people getting this - may be my fault is different though.
I have some example and test sketches in separate subdirectories to my main project directory. To build one of these, I will uncomment the respective env lines in platformio.ini. Here is an example that is supposed to build a test program:
But when building this, I get the notorious undefined reference to loop()/setup() messages. The file ./Test/main.cpp has both, but never is mentioned in the compiler log.
So I assume despite the build_src_filter setting the Test directory is not considered at all.
The Test-Folder is for unit tests, not for holding your project source files.
See the README inside this folder:
This directory is intended for PlatformIO Test Runner and project tests.
Unit Testing is a software testing method by which individual units of
source code, sets of one or more MCU program modules together with associated
control data, usage procedures, and operating procedures, are tested to
determine whether they are fit for use. Unit testing finds problems early
in the development cycle.
I always thought the PlatformIO folder would be named “test” (lowercase “t”), not “Test” (uppercase)?
Anyway, putting the testing and example files into src would spoil the library code that resides in there, so I do not think that would be a real solution.