Gregor Brandt
Gregor Brandt

Reputation: 7799

C++ Builder STL for OS X fails?

Has anybody tried something as simple as #include <vector> in an application for the Mac compiled with XE2?

Is something so basic broken in XE2 update 1 for C++ Builder or is my install broken?

Simply adding #include <vector> to a new fire monkey HD app, I get build failures:

[BCC32 Error] cstdlib(43): E2015 Ambiguity between 'ldiv_t' and 'Posix::Stdlib::ldiv_t'
  Full parser context
    Unit1.cpp(7): #include C:\Program Files\Embarcadero\RAD Studio\9.0\include\boost_1_39\boost\tr1\tr1\vector
     vector(16): #include C:\Program Files\Embarcadero\RAD Studio\9.0\include\boost_1_39\boost/tr1/detail/config_all.hpp
    config_all.hpp(48): #include c:\program files\embarcadero\rad studio\9.0\include\dinkumware\cstdlib
    cstdlib(32): namespace std

From the code:

//---------------------------------------------------------------------------

#include <fmx.h>
#pragma hdrstop

#include "Unit1.h"
#include <vector>

//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.fmx"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
   : TForm(Owner)
{
}
//---------------------------------------------------------------------------

Upvotes: 1

Views: 637

Answers (2)

Gregor Brandt
Gregor Brandt

Reputation: 7799

Solution from Embarcadero (this is for update 2 only):

  • Open cstdlib in the [RADStudioXE2]\include\dinkumware directory
  • Take line 49: using _CSTD size_t; using _CSTD div_t; using _CSTD ldiv_t;
  • Move it above the "#if defined" block right above it (line 33)

The STL can now be compiled into an FMX C++ application

Upvotes: 1

David Dean
David Dean

Reputation: 2632

try removing $(CG_BOOST_ROOT) from your include paths.

Upvotes: 0

Related Questions