Standard Template Library / C++

Technical questions regarding the XTC tools and programming with XMOS.
steamboy
New User
Posts: 2
Joined: Tue Jul 06, 2010 8:29 am

Standard Template Library / C++

Post by steamboy »

Hello,

Is it possible to use the STL / new operator in my C++ code ?

I have a lot of errors during the compilation process.

Thanks for your help,
Best regards,
Christophe.


richard
Respected Member
Posts: 318
Joined: Tue Dec 15, 2009 12:46 am

Post by richard »

steamboy wrote:Hello,

Is it possible to use the STL / new operator in my C++ code ?

I have a lot of errors during the compilation process.

Thanks for your help,
Best regards,
Christophe.
Can you give examples of the errors you are getting? All of the C++ standard library is available, but some parts may not fit in the RAM available on the XCore. Some parts of the standard library need exceptions turned on. Exception handling support is turned off by default in the tools to reduce code size. If you see errors like:
error: exception handling disabled, use -fexceptions to enable
Recompile your program with -fexceptions.
JohnR
Experienced Member
Posts: 93
Joined: Fri Dec 11, 2009 1:39 pm

Post by JohnR »

Hi,

A stupid question - you were working on a .cpp file not a .c file and bringing in the correct header files?

From the Tools User Guide - page 141
The four possible stages of compilation are preprocessing, compilation proper,
assembly and linking/mapping. The first three stages are applied to an individual
source file, producing an object file. Linking and mapping combine the object files
and an XN file into a single executable XE file, which contains the code and data
segments for each core.
The suffix of a source file determines how it is handled by default.

Extension Type of File
.xc XC source code
.c C source code
.cpp C++ source code

John