PlatformIO Community

Change the 'main' file in src folder



I have the following problem: I have a program in a file called main.cpp however I want to try to solve the task with a fsm to see which version wors better. So instead of deleting the old main.cpp I’d like to keep this file and build the code inside of fsm.cpp.

To do this I have added:

platform = atmelavr
board = uno
framework = arduino
src_filter = -<main.cpp>

to platformio.ini.
However if I build the project using

platformio run --environment debug --target upload

I get an error saying

In function 'main':<artificial>:(.text.startup+0x86):undefined reference to 'setup'
<artificial>:(.text.startup+0x8e):undefined reference to 'loop'

However fsm.cpp contains a loop() and a setup() function.

I also tried setting

TARGET = fsm

in Makefile, but that didn’t help.

I didn’t find anything searching for a similar error so I would be glad for any idea on how to resolve this.




src_filter = +<*> -<main.cpp>


thanks that fixed it, a dumb mistake to make really