UniGraphic library compiler errors

Board: F103RB
Mbed Version: 6.2.1
Method: Mbed Studio: 1.2.1

I am trying to use the UniGraphic library but I receive errors. Is the library not compatible?
The library compiles in the online compiler.
What to use for the ILI9341/ILI9488/ST7796s devices into Mbed Studio?

Compile [ 97.4%]: LCD.cpp
[Error] TextDisplay.h@23,28: expected class name
[Error] Terminal6x8.h@10,1: C++ requires a type specifier for all declarations
[Error] Terminal6x8.h@10,11: expected ‘;’ after top level declarator
[ERROR] In file included from .\UniGraphic\Display\LCD.cpp:21:
In file included from ./UniGraphic/Display/LCD.h:16:
In file included from ./UniGraphic/Graphics\GraphicsDisplay.h:17:
./UniGraphic/Graphics/TextDisplay.h:23:28: error: expected class name
class TextDisplay : public Stream {
^
In file included from .\UniGraphic\Display\LCD.cpp:21:
In file included from ./UniGraphic/Display/LCD.h:16:
In file included from ./UniGraphic/Graphics\GraphicsDisplay.h:18:
./UniGraphic/Font\Terminal6x8.h:10:1: error: C++ requires a type specifier for all declarations
__align(2)
^
./UniGraphic/Font\Terminal6x8.h:10:11: error: expected ‘;’ after top level declarator
__align(2)
^
;
3 errors generated.

Ahoj,

the UniGraphic library is little bit old and during last 5 years were too much changes in the MbedOS and also its tools and the library is not maintained by owner or community via PullRequests. Usually, when you check the Forks, you can find a copy of original repository which is not so old and that can work.
Here you can see a version of UniGraphic by Duncan McIntyre . That looks like already fixed.

If you want to fix it by yourself you need to follow compiler messages and fix all erros.

  • In the folder of the library you can find folder with name Font and all files inside include line with __align(2). You need to commented it out //__align(2).
  • in the TextDisplay.h you need to add #include "Stream.h"
  • and so on.

BR, Jan

Hi Johnny,

I have already corrected build errors. You can add wait_ms and wait to replace by wait_us. In fact plenty of libraries are not updated. I wil try the corrected code later. Tnx for your help.

Alain