undefined reference to `touchgfx::paint::rgb888::lineFromColor

问题描述:

RTThread+TouchGFX开发编译报错,错误原因是Line控件相关函数touchgfx::paint::rgb888::lineFromColor,在新版本中可能被屏蔽了,需要将其调用出来

D:\RT-ThreadStudio\workspace\ART\libraries\touchgfx_lib\Middlewares\ST\touchgfx\lib\core\cortex_m7\gcc\libtouchgfx-float-abi-hard.a(PainterRGB888.o):In function `touchgfx::PainterRGB888::paint(unsignedchar*,short,short,short,short,unsignedchar)const':(.text._ZNK8touchgfx13PainterRGB8885paintEPhssssh+0x18):undefined reference to `touchgfx::paint::rgb888::lineFromColor(unsignedchar*,unsignedint,unsignedlong,unsignedchar)' D:\RT-ThreadStudio\workspace\ART\libraries\touchgfx_lib\Middlewares\ST\touchgfx\lib\core\cortex_m7\gcc\libtouchgfx-float-abi-hard.a(PainterRGB888.o):In function `touchgfx::PainterRGB888::tearDown()const':(.text._ZNK8touchgfx13PainterRGB8888tearDownEv+0x0):undefined reference to `touchgfx::paint::rgb888::tearDown()'

解决方法

按照下面三个步骤进行操作

1、将hal文件夹添加构建


2、将canvas文件夹添加构建

3、在PainterRGB888.hpp中添加头文件

【注意:若修改,虽说能画线,但是整个工程的C/C++索引器会失效!即无法跳转函数或查看变量定义,这是TouchGFX4.23.0版本BUG,建议更新更高版本】