2018-10-22 04:20 AM
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
2018-10-22 06:21 AM
I thought Atollic used GCC ?
2018-10-22 06:28 AM
Last time I checked CubeMx was C only.
Atollic (and gcc) surely do support C++, and C++ projects.
2018-10-22 07:24 AM
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.
2018-10-22 07:34 AM
@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?
2018-10-22 11:13 PM
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
2018-10-23 12:49 AM
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:
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...
2018-10-23 01:39 AM
2018-10-23 01:40 AM
2018-10-23 01:46 AM
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.