First build often fails after changing platformio.ini
See original GitHub issueSolution
See https://github.com/platformio/platformio-core/issues/2972
Please convert INO files to CPP https://docs.platformio.org/en/latest/faq.html#convert-arduino-file-to-c-manually
Configuration
Operating system: Windows 10
PlatformIO Version (platformio --version
): 4.0.3
Platform: Arduino (ESP8266 to be exact)
Editor/IDE: VS-Code
Description of problem
When changing the platformio.ini file, and save it, a test is run to create a <project>.ino.cpp file. At the end of this test, the file is deleted. If you start a build while this test has not yet finished, then the .ino.cpp file is gone by the time the compile run is ready for processing this file.
This is what happens if you don’t save the file yet but just hit the ‘build’ task to run. It will save all open (unsaved) files and start building. This save triggers the test run also.
Steps to Reproduce
- Make changes in platformio.ini Don’t save yet
- Start compile
- Compile fails, since
setup()
norloop()
is found
Issue Analytics
- State:
- Created 4 years ago
- Comments:11 (7 by maintainers)
Thanks! You gave me an idea. The issue is not linked with VS Code autosaving. The problem is that after “saving” of platformio.ini PlatformIO IDE extension rebuilds C/C++ project index. This is an issue. I will think about how to resolve it.
I reproduced this issue last time. It’s only related when Arduino INO file is used. There is a race condition when PlatformIO Build System and Project Index Builder convert INO to CPP. We will work on good fix for this case.