PlatformIO Community

Can't seem to exclude a cpp file from the build using src_filter

I am adding a library from GitHub as a submodule. It includes a main.cpp file that is causing multiple definition problems at the linking step. I tried excluding it using src_filter, but no luck. Of course, I can manually delete the file, but I would have to do that every time I update the submodule. I was hoping for a simple way to exclude it from the build.

platform = espressif8266
board = esp12e
framework = arduino
lib_deps =
src_filter = +<*> -<.git/> -<.svn/> -<example/> -<examples/> -<test/> -<tests/>

Read through

For further help we’d need to know the folder and file structure in src/.

Thanks! I suppose I was over-thinking it. I was assuming that since the other entries in src_filter specify paths relative to the main project folder (i.e., .git/ and test/) that I should do the same for the submodule folder in src/. But that is not the case. The following code does the job.

src_filter = +<*> -<.git/> -<.svn/> … -<DebounceSwitch_submodule/main.cpp>