iterator error/conflict on Android with push_back (FMX, C++)


I have an FMX app with a TPanel and a TScrollBox. The code below is in a TButton click event and it creates a new TChart when clicked (clones an existing chart i’m using as template). This works fine in Win32 and iOS, but fails to build for Android.

If i comment out the myCharts.push_back(C) it will build and run on Android but of course not add the new chart C to myCharts vector.

TChart *C = new TChart(this);
C->Parent = this->ScrollBox1;
CloneChart(C, ChartTemplate, this, false); // i have a template chart to copy from
C->Align = TAlignLayout::Horizontal;
C->Height = ChartTemplate->Height;
C->Width = ChartTemplate->Width;
C->Tag = myCharts.size();
C->HitTest = false;
ReSizeCharts(); // resize all charts to accommodate new one

At the top of my Unit1.cpp i define myCharts as a global vector:

std::vector<TChart*> myCharts;

When i attempt the Android build i get the following error messages and the ide opens stl_iterator.h and highlights a row in red:

[bccaarm Error] stl_iterator.h(980): rvalue reference to type ‘value_type’ (aka ‘Fmxtee::Chart::TChart*__strong’) cannot bind to lvalue of type ‘__borland_class *isTObj<Fmxtee::Chart::TChart> __strong'(aka ‘Fmxtee::Chart::TChart *__strong’)

Here are my includes:

#include <FMXTee.Store.hpp>
#include <System.IOUtils.hpp>
#include <stdio.h>
#include <vector>
#include <memory>

I’m using 10.3.1 (Embarcadero® C++Builder 10.3 Version 26.0.33219.4899). Android SDK 25.2.5 32-bit.

Comments are closed.