question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

First build often fails after changing platformio.ini

See original GitHub issue

Solution

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

  1. Make changes in platformio.ini Don’t save yet
  2. Start compile
  3. Compile fails, since setup() nor loop() is found

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
ivankravetscommented, Sep 8, 2019

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.

1reaction
ivankravetscommented, Nov 1, 2019

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Platformio build fails
I have tried several uninstall and reinstalls of python 3.8 and VScode 1.42, cleaning out as much as allowed in the registry and...
Read more >
Clean build after making changes to platformio.ini file
Hey,. First up, let me just say that I'm blown away by Platform IO! Well done! I notice that if I make changes...
Read more >
Always full rebuild allegedly after V4.0.0 - is my platformio.ini ...
Hi There, Platform IO used to always work as expected, only building the files that were altered or dependent upon an edited file....
Read more >
Unable to build a simple project - PlatformIO Community
As a first step, please remove the C:\Users\<user>\.platformio\packages\toolchain-atmelavr folder completely, then try building again.
Read more >
Build Fails after most recent Updates - PlatformIO Community
After last weeks updates, I now get the following error when trying ... Some changes to the PATH may eventually only be seen...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found