cancel
Showing results for 
Search instead for 
Did you mean: 

Atollic C++ implementation

diego ambroggi
Associate III

Hello Mr./Ms.

I need to implement some libraries e.g. Arduino or other open source code.

So I tried to import in Atollic a C++ librarie but returns an error when I instance a class.

It's possible to do that or only C moddules are supported?

I generate code using CubeMx tool.

Thanks in advance

Best regards 

14 REPLIES 14
Andrew Neil
Chief II

I thought Atollic used GCC ?

AvaTar
Lead

Last time I checked CubeMx was C only.

Atollic (and gcc) surely do support C++, and C++ projects.

AVI-crak
Senior

Compiled libraries for Arduino - often have code for floating point double precision in emulation mode on eight-bit arithmetic. This is an abundance of macros that are simply not visible to the user. Using one variable in floating point mode - instantly includes the entire set of obscurantism from prehistoric dinosaurs. Do you really need it?

And further. Limit the use of compiled libraries of others in your projects. This will limit you to a lot of subtle problems.

For example, the most childish problem is switching the type of processor core in the macro body.

Andrew Neil
Chief II

@AVI-crak​  - As @diego ambroggi​  spoke of "open source", I had assumed he was talking about source code.

But, yes - using ready-compiled libraries would raise issues of configuration, dependencies, etc.

@diego ambroggi​  - perhaps you could be more specific about what "error" you got - and what, exactly, you were doing to provoke it?

diego ambroggi
Associate III

Hello everyone,

Yes Atollic use GCC compiler, is one of the options provided by CubeMx code generator.

Compiler error is simply due to "calss" call not recognized.

I tried to import an SPI EEPROM library from Arduino repository.

So, I can extrapolate individually functions but I think C++ libraries are powerfull.

Thanks

Andrew Neil
Chief II

That still doesn't tell us what "error", exactly, you got - and what, exactly, you were doing to provoke it.

So it doesn't help to resolve the issue.

You need to show the relevant part of the source code, and the full text of the error message.

Use copy & paste.

Use the 'Code Snippet' button for source code:

0690X000006CESvQAO.png

Have you told the compiler to compile as C++ ?

Usually, the source file extension - .c or .cpp - will select 'C' or C++ mode, but can be overridden by options...

diego ambroggi
Associate III

Hello Andrew

I imported Arduino EEPROM_CAT25 files (.cpp .h) and I tried to instance EEPROM_CAT25 object.

Error is shown in jpeg file attached

Thanks in advance

Diego

diego ambroggi
Associate III

This is Arduino code for EEPROM

Andrew Neil
Chief II

0690X000006CEV6QAO.jpg

As I said, the .c extension on main.c tells the compiler to compile is as 'C' - not C++

Clearly, the 'class' keyword is not valid in 'C' !

If you're going to have part of your project in 'C', and part in C++, I think it's generally recommended to make your 'main' a C++ file.

This is general - not specific to STM32 or GCC.