Skip to main content
RG.3
Associate III
December 7, 2020
Solved

What file we need to include to use" touchgfx ::Unicode::UnicodeChar " and strncpy

  • December 7, 2020
  • 2 replies
  • 3893 views

In my code when I am using touchgfx::Unicode::UnicodeChar it is showing expected an expression....What files should I include to solve this error

This topic has been closed for replies.
Best answer by Martin KJELDSEN
#include <touchgfx/Unicode.hpp>

2 replies

Martin KJELDSEN
Martin KJELDSENBest answer
Principal III
December 7, 2020
#include <touchgfx/Unicode.hpp>

RG.3
RG.3Author
Associate III
December 8, 2020

As soon as I include this file. I am getting many errors . I have to use "touchgfx ::Unicode::UnicodeChar" outside the touchgfx folder in order to display a char arrray....Can you please guide what should I do next?

Error[Pe020]: identifier "namespace" is undefined C:\Users\SESA566532\Desktop\rishi\disp_arm\Middlewares\ST\touchgfx\framework\include\touchgfx\hal\Types.hpp 79 
Error[Pe065]: expected a ";" C:\Users\SESA566532\Desktop\rishi\disp_arm\Middlewares\ST\touchgfx\framework\include\touchgfx\hal\Types.hpp 80 
Error[Pe169]: expected a declaration C:\Users\SESA566532\Desktop\rishi\disp_arm\Middlewares\ST\touchgfx\framework\include\touchgfx\hal\Types.hpp 153 
Error[Pe020]: identifier "class" is undefined C:\Users\SESA566532\Desktop\rishi\disp_arm\Middlewares\ST\touchgfx\framework\include\touchgfx\hal\Types.hpp 162 
Error[Pe065]: expected a ";" C:\Users\SESA566532\Desktop\rishi\disp_arm\Middlewares\ST\touchgfx\framework\include\touchgfx\hal\Types.hpp 163 
Error[Pe040]: expected an identifier C:\Users\SESA566532\Desktop\rishi\disp_arm\Middlewares\ST\touchgfx\framework\include\touchgfx\hal\Types.hpp 216 
Error[Pe099]: a declaration here must declare a parameter C:\Users\SESA566532\Desktop\rishi\disp_arm\Middlewares\ST\touchgfx\framework\include\touchgfx\hal\Types.hpp 216 
Error[Pe065]: expected a ";" C:\Users\SESA566532\Desktop\rishi\disp_arm\Middlewares\ST\touchgfx\framework\include\touchgfx\hal\Types.hpp 229 
Error[Pe130]: expected a "{" C:\Users\SESA566532\Desktop\rishi\disp_arm\Middlewares\ST\touchgfx\framework\include\touchgfx\hal\Types.hpp 374 
Error[Pe169]: expected a declaration C:\Users\SESA566532\Desktop\rishi\disp_arm\Middlewares\ST\touchgfx\framework\include\touchgfx\hal\Types.hpp 375 
Error[Pe077]: this declaration has no storage class or type specifier C:\Users\SESA566532\Desktop\rishi\disp_arm\Middlewares\ST\touchgfx\framework\include\touchgfx\hal\Types.hpp 458 
Error[Pe065]: expected a ";" C:\Users\SESA566532\Desktop\rishi\disp_arm\Middlewares\ST\touchgfx\framework\include\touchgfx\hal\Types.hpp 458 
Error[Pe169]: expected a declaration C:\Users\SESA566532\Desktop\rishi\disp_arm\Middlewares\ST\touchgfx\framework\include\touchgfx\hal\Types.hpp 713 
Error[Pe018]: expected a ")" C:\Users\SESA566532\Desktop\rishi\disp_arm\Middlewares\ST\touchgfx\framework\include\touchgfx\hal\Types.hpp 736 
Error[Pe168]: a function type is not allowed here C:\Users\SESA566532\Desktop\rishi\disp_arm\Middlewares\ST\touchgfx\framework\include\touchgfx\hal\Types.hpp 736 
Error[Pe065]: expected a ";" C:\Users\SESA566532\Desktop\rishi\disp_arm\Middlewares\ST\touchgfx\framework\include\touchgfx\hal\Types.hpp 737 
Error[Pe077]: this declaration has no storage class or type specifier C:\Users\SESA566532\Desktop\rishi\disp_arm\Middlewares\ST\touchgfx\framework\include\touchgfx\hal\Types.hpp 877 
Error[Pe065]: expected a ";" C:\Users\SESA566532\Desktop\rishi\disp_arm\Middlewares\ST\touchgfx\framework\include\touchgfx\hal\Types.hpp 877 
Error[Pe169]: expected a declaration C:\Users\SESA566532\Desktop\rishi\disp_arm\Middlewares\ST\touchgfx\framework\include\touchgfx\hal\Types.hpp 1012 
Error[Pe147]: declaration is incompatible with "__nounwind __interwork __vfp size_t strlen(char const *)" C:\Users\SESA566532\Desktop\rishi\disp_arm\Middlewares\ST\touchgfx\framework\include\touchgfx\Unicode.hpp 68 
(declared at line 54 of "C:\Program Files (x86)\IAR Systems\Embedded Workbench 8.3\arm\inc\c\string.h") 
Error[Pe147]: declaration is incompatible with "__nounwind __interwork __vfp char *strncpy(char *restrict, C:\Users\SESA566532\Desktop\rishi\disp_arm\Middlewares\ST\touchgfx\framework\include\touchgfx\Unicode.hpp 88 
char const *restrict, size_t)" (declared at line 60 of "C:\Program Files (x86)\IAR Systems\Embedded 
Workbench 8.3\arm\inc\c\string.h") 
Error[Pe147]: declaration is incompatible with "__interwork __vfp uint16_t strncpy(uint16_t *, uint16_t const *, C:\Users\SESA566532\Desktop\rishi\disp_arm\Middlewares\ST\touchgfx\framework\include\touchgfx\Unicode.hpp 108 
uint16_t)" (declared at line 88) 
Error[Pe147]: declaration is incompatible with "__interwork __softfp uint16_t *snprintf(uint16_t *, uint16_t, C:\Users\SESA566532\Desktop\rishi\disp_arm\Middlewares\ST\touchgfx\framework\include\touchgfx\Unicode.hpp 252 
uint16_t const *, ...)" (declared at line 178) 
Error[Pe147]: declaration is incompatible with "__interwork __vfp uint16_t *vsnprintf(uint16_t *, uint16_t, C:\Users\SESA566532\Desktop\rishi\disp_arm\Middlewares\ST\touchgfx\framework\include\touchgfx\Unicode.hpp 270 
uint16_t const *, va_list)" (declared at line 196) 
Error[Pe147]: declaration is incompatible with "__interwork __vfp uint16_t *snprintfFloats(uint16_t *, uint16_t, C:\Users\SESA566532\Desktop\rishi\disp_arm\Middlewares\ST\touchgfx\framework\include\touchgfx\Unicode.hpp 433 
uint16_t const *, float const *)" (declared at line 320) 
Error[Pe247]: function "snprintfFloat" has already been defined (at line 370) C:\Users\SESA566532\Desktop\rishi\disp_arm\Middlewares\ST\touchgfx\framework\include\touchgfx\Unicode.hpp 495 
Error[Pe167]: argument of type "char const *" is incompatible with parameter of type "uint16_t const *" C:\Users\SESA566532\Desktop\rishi\disp_arm\Middlewares\ST\touchgfx\framework\include\touchgfx\Unicode.hpp 497 
Error[Pe147]: declaration is incompatible with "__nounwind __interwork __vfp int strncmp(char const *, char C:\Users\SESA566532\Desktop\rishi\disp_arm\Middlewares\ST\touchgfx\framework\include\touchgfx\Unicode.hpp 521 
const *, size_t)" (declared at line 58 of "C:\Program Files (x86)\IAR Systems\Embedded Workbench 8.3\ 
arm\inc\c\string.h") 
Error[Pe077]: this declaration has no storage class or type specifier C:\Users\SESA566532\Desktop\rishi\disp_arm\Middlewares\ST\touchgfx\framework\include\touchgfx\Unicode.hpp 577 
Error[Pe065]: expected a ";" C:\Users\SESA566532\Desktop\rishi\disp_arm\Middlewares\ST\touchgfx\framework\include\touchgfx\Unicode.hpp 577 
Error[Pe018]: expected a ")" C:\Users\SESA566532\Desktop\rishi\disp_arm\Middlewares\ST\touchgfx\framework\include\touchgfx\Unicode.hpp 580 
Error[Pe169]: expected a declaration C:\Users\SESA566532\Desktop\rishi\disp_arm\Middlewares\ST\touchgfx\framework\include\touchgfx\Unicode.hpp 583 
Error[Pe169]: expected a declaration C:\Users\SESA566532\Desktop\rishi\disp_arm\Middlewares\ST\touchgfx\framework\include\touchgfx\Unicode.hpp 584 
Error[Pe114]: function "snprintfFloats" was referenced but not defined C:\Users\SESA566532\Desktop\rishi\disp_arm\Middlewares\ST\touchgfx\framework\include\touchgfx\Unicode.hpp 320 
Error while running C/C++ Compiler

Martin KJELDSEN
Principal III
December 9, 2020

UnicodeChar is just typedeffed as uint16_t. I think you're including the file in some c-code. Keep TouchGFX code in cpp. What're you trying to do? I'm positive there's another way around it.

Flemming Gram CHRISTENSEN
ST Employee
December 11, 2020

One comment to add:

TouchGFX uses 16 bit characters (UnicodeChar). Any data coming from 8-bit sources must be converted to 16bit. This can be done with Unicode::strncpy and the similar functions. These are basically just extending the (unsigned) 8-bit values to 16-bit. Then TouchGFX can show the characters, provided the font contains the characters as explained above. Typically a range of printable characters ascii are required if you plan to receive strings from say a serial port. The TouchGFXDesigner only includes the characters used by the texts in the project.

We also have a converter from UTF-8 to U16, which can be used when you received a text from eg. a cell-phone.