Skip to main content
diego ambroggi
Associate III
October 22, 2018
Question

Atollic C++ implementation

  • October 22, 2018
  • 14 replies
  • 2720 views

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 

    This topic has been closed for replies.

    14 replies

    Andrew Neil
    Super User
    October 22, 2018

    I thought Atollic used GCC ?

    A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
    AvaTar
    Senior III
    October 22, 2018

    Last time I checked CubeMx was C only.

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

    AVI-crak
    Senior
    October 22, 2018

    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
    Super User
    October 22, 2018

    @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?

    A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
    diego ambroggi
    Associate III
    October 23, 2018

    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
    Super User
    October 23, 2018

    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...

    A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
    diego ambroggi
    Associate III
    October 23, 2018

    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
    October 23, 2018

    This is Arduino code for EEPROM

    Andrew Neil
    Super User
    October 23, 2018

    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.

    A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
    diego ambroggi
    Associate III
    October 23, 2018

    Hi Andrew

    I simply changed main.c in main.cpp but I have a lot of error generated (see attached).

    I think is mandatory to change some eclipse settings.

    have some tips?

    Best regards