PlatformIO Community

Testing parts of my code, get error "Undefined reference to 'setup'" and same for 'loop'

I’m using PlatformIO for Arduino and I’d like to try to test parts of code and examples to troubleshoot my project.

I’ve followed the instructions from:

I’m trying to run an example test code for a graphical LCD.
When running platformio test, I get the following error:

In function main:
undefined reference to setup
undefined reference to loop

Also, I’m unable to run platformio test -v to get a verbose output.


Seems like renaming my test file from .ino to .cpp solved my problem.

However, I’m still not able to run commands other than platformio test
For example, if I want to run a single test file, I tried running platformio test --filter "mytestname*" without any success…

Any error messages? What’s the expected and actual output?

1 Like