Using C++ Standard Library on Gamebuino META

General

UnPolacoLoco

3 months ago

Hey all,


First of all, I'm new here so - hello :)


I have some experience with Arduino boards, the UNO and Esplora. I've done a couple of projects before, an RC car and a LED matrix clock but this is my first proper dive into games in the Arduino ecosystem. 

I use a C++ standard library port (https://github.com/maniacbug/StandardCplusplus) to make use of a couple of nice features, containers mostly. To my surprise, the code stops compiling the moment I select "Gamebuino META" as the board while it does still work for Esplora and Uno boards. The error output log is attached to this thread. ErrorGamebuino.txt 

My programming knowledge is not on a level where I can make use of anything the compiler is trying to tell me there. The same errors occur on the Arduino IDE as well as my Visual Micro VS plugin. I noticed the project Caterbuino using std:: operator, so I assume it's also possible. Is there a tool/library I'm missing?


Many thanks!

Sorunome

NEW 3 months ago

Unfortunately it seems like the library you are using isn't compatible with our build system, as it doesn't follow the C++ standards. We are compiling with -std=gnu++11. Since dynamic memory allocation is rather sub-optimal on an embedded system with only 32K of ram, a container like an std::vector would be rather slow anyways, and you'd probably run into many ram issues down the road.

I'd suggest trying to break up the problem you are trying to solve and tackling it without the STL, if you need help, you are, of course, free to ask!


EDIT: To clarify, std:: is not an operator, something like std::blah says "use blah out of the namespace std"

Mokona

NEW 3 months ago

I'm using part of the STL with success on Snakuino. But I'm not sure which one, I just installed the first one I found in Arduino libraries.

vector is rather usable if its reserved size is carefully taken of.

UnPolacoLoco

NEW 3 months ago

@Sorunome makes sense, thanks! I've started my programming from C# and then went on to C++, so I got pretty spoiled with List<>, Vector<>, and other safe containers. Regarding breaking down the problem - there is none yet as I'm only trying what I've been using on Uno and Esplora so far, just doing my research :)

@Mokona - could you look into the library header file and let me know? 

Mokona

NEW 3 months ago

I'm still unconfortable with the Arduino toolchain when it comes to understand where it fetches libraries from. But it seems I've installed a package called ArduinoSTL and if the toolchain is doing its job, I guess that's the one I use.

You must be logged in in order to post a message on the forum

Log in