Problems compiling with PlatformIO


You should not have to do that though. Someone should file an issue with Platformio. That is a bug.


I was suspecting it :grin:
I’m not sure I can fill a bug with enough information. Let’s wait to see if it’s something related to my own computer or if it happens to someone else.


(Edited from original context for migration purposes)

Agreed. So far we don’t have enough to go on to make a proper bug report.
Ideally we’d at least want steps to reproduce the problem.


I recently encountered a similar issue after updating my nxplpc version and made an issue about it on the PlatformIO forums.

I mentioned it to @jonne and he said it’s probably the same as this issue, and sure enough the fix that fixed this issue fixed my issue, so I think it’s an issue with the particular nxplpc version.

I updated from (I think) v3.3.something to v3.4.1, so I’m guessing somewhere between those points the system broke.
I plan to follow it up assuming someone responds to my issue.
I may have to chase it on GitHub instead.


Good plan.



I’m changing my mind again. If you “Install” a library through the manager in PIO, it gets copied to a .hidden directory.

There’s no other way but to go seek that dir copy the files over to your project etc.

I fail to see this as easy for a beginner

Am I totally misunderstandin the lib manager because like this (libs essentially hidden) how am I going to explain copy-pasting the platform.ini etc? Help, any advice welcome.


I don’t think it was hidden on Windows, but I could be wrong.
(I have ‘show hidden files’ turned on so I often don’t notice if something’s supposed to be hidden.)

I can see that it would be hidden on Mac by default because of the leading dot (though I’d argue that’s a flaw in Mac’s file system design - making anything prefixed with a dot hidden by default instead of just using file attributes).

To copy which files?

platformio.ini isn’t hidden.

Though I’m guessing if Mac hides all folders begining with a dot then .pioenvs, .vscode, .travis.yml and .gitignore are probably all hidden on Mac?

I’m sure a script could get around that though.
E.g. maybe an ‘after successful build’ script could copy the .bin file up to the project folder.

I think a lot of our problems with “how to make this easy for beginners” will be solvable by scripting.
It’s usually easier to explain “move this file from this hidden folder into this other folder” to a computer than it is to a non-technical person.

It’s almost impossible to find something that’s easy for a beginner and still provides all the powertools that an advanced programmer would want/need.
Linking libraries in is difficult enough as it is even when you do know what you’re doing.

The Arduino IDE is easy for beginners to use, and we all know what most programmers think of the Arduino IDE - they bin it and use VSCode or Visual Studio instead.

It’s imperative that we have a cross-platform C++11-capable IDE available.

If we settle for something that isn’t cross platform, that’s a significant fraction of potential users gone.

If we settle for something that doesn’t have C++11 support then we have to be prepare to put up with all the people asking “why doesn’t this game compile? why does it say ‘error: requires C++11’?”.

So far I think that even with these minor setbacks VSCode + PlatformIO is easier to use than a full scale IDE like EmBitz because you don’t have to worry about build targets,
you just have different projects instead of different build targets.
And often you can just copy a project and rename it without having to fiddle about with any IDE menus.

The only other alternative to VSCode at the moment is @FManga’s work on Code::Blocks.

We could perhaps look in to making some kind of makefile that will work with a larger IDE (e.g. Code::Blocks) or trying to get the custom GCC to work with something like VSCode,
but I’m expecting either of those will be more work than trying to improve what we’ve already got.

(If EmBitz had been cross platform in the first place then we wouldn’t have to be worrying about any of this.)

I’ll look more into how PlatformIO works and how to script it if I get chance, but I’m trying to cut down on the number of projects I work on concurrently because I keep having to put things on hold.


I had stopped work on that since PlatformIO seamed to be the better solution. If it’s insufficient for some reason, based on my brief experience rooting through the Code::Blocks source code, I think it’d be easier to just make a VSCode plugin that includes GCC and the PokittoLib.


I concur.

Lightweight editors like Atom and VSCode seem to be very popular with ‘hobbyist’ programmers at the moment.
(I presume they’re still mainly using heavyweight IDEs in business/‘professional’ programing.)

I haven’t looked into how easy it is to make an extension for VSCode, but that’s a possibility if we can’t iron out the issues with PIO.
(Though so far apart from this issue that’s cropped up from updating the platform, I haven’t had any other problems with PlatformIO, so I’m not in a hurry to drop it.)

Making our own extension would still be a fair bit of extra work though. We’d have to decide if we were going to use just GCC for compiling or mix GCC and makefiles, and we’d need to develop an easy to use project settings format so people could have custom compiler flags (because frankly neither bare compiler settings or makefiles are beginner friendly).

(Maybe we could even take a leaf out of PlatformIO’s book and use SCons - programmatic Python scripts for build configuration.)


I’m not in a hurry either, but that’s because I’m happy using emacs+make. :stuck_out_tongue:
I did not mean to say we should be ditching PlatformIO. I only suggested making an extension as the alternative to Code::Blocks if it’s ever decided that PlatformIO is a problem.

VSCode uses JSON files for configuration, that would be the more natural fit. Ideally, the extension would just handle the build process on its own and users wouldn’t have to mess with flags unless they really wanted to.


I didn’t take it that way.
I just wanted to clarify that my thoughts about making a VSCode extension shouldn’t imply that I want to get rid of PlatformIO.

I agree, it’s probably one of the better alternatives.

I’m not a big fan of JSON because I’m always being bitten by missing commas or having too many commas,
but if an API for manipulating JSON is built-in and there aren’t built-in APIs for other options (e.g. XML, INI, YAML) then it’ll probably have to be JSON.

But allowing Pokitto projects might need to include a config file (equivalent to the current platformio.ini) that specifies extra build flags, like -std=c++14 for people who want to go beyond C++11 and the dreaded -fpermissive to make Arduboy projects slightly easier to port.

Allowing such a file to be bundled with projects means that the experts can tweak the flags to their hearts content and the beginners wouldn’t have to worry - they can just rely on the config file that comes with the project they download to handle the flags for them.
(And of course, if the config doesn’t specify otherwise, default to -std=c++11.)


If that’s the case, how do you do source level debugging? Command-line gdb?


Emacs has gdb support built in.

Edit: isn’t debugging a paid feature in platformio? I tested debugging in VSCode using the Cortex plugin, works OK.


Ah? Sounds good. Sure you didn’t start the 30 day PIO pro trial by mistake?


I didn’t install PIO at all, yet. I keep meaning to do so, but I haven’t had much time lately.


The documentation indicates that you need an account but doesn’t mention needing to pay to use the debugger.
The pricing page on their website on the other hand does seem to indicate that the debugger is a paid for feature.

Personally I don’t use a proper debugger very much because I’ve got used to not having one for AVR chips,
I tend to just print everything onto the screen when I run into a problem.
Even when writing C# I tend to print to the console for debugging more than I use the step feature.

This one? I would assume it could be used alongside PlatformIO.


I tend to rely on the debugger a lot. Partially because of habits from javascript, where you check for run-time errors instead of compile-time. Also, it’s hard to use print to debug code that needs to run a few hundred thousand times per second (emulator cores).



Usually I put a conditional statement in place that specifically looks for invalid values, even if I do use a proper debugger.

If I get the time I’ll look into whether it can be used alongside PlatformIO.

If I don’t get the time, maybe someone else reading this can check.