Skip to main content
Associate
July 20, 2026
Solved

Touchgfx and CubeMX2 : Enable vector rendering

  • July 20, 2026
  • 2 replies
  • 77 views

Hello everyone,

 

I’ve been working for a few weeks on a TouchGFX project using a MCU that is working with CubeMX2, so I used the documentation (Using TouchGFX with STM32CubeMX2 | TouchGFX Documentation) to setup my project, which is working.

However I tried to add an SVG Image and then I got the “undefined reference to ‘touchgfx::VectorRenderer::getInstance()’” issue. Normally this issue can be resolved by enabling vector rendering in CubeMX, but because I’m on CubeMX2 it’s not possible in my case.

Is there any way to enable vector rendering manually ? Also just to be sure it wasn’t already activated I tried to put a SVG image with the example project that I started with (the NUCLEO-C5A3ZG + RVA15MD project), and I got the same error.

MCU used is STM32C552RET6.

Best answer by JohanAstrup

Hello ​@Guillaume Clouard.

As the integration of TouchGFX with STM32CubeMX2 is currently not as seamless as the integration with the original STM32CubeMX, you need to add some code manually to enable vector support. Fortunately, the code is quite simple. You need to add the following to TouchGFXGeneratedHAL.cpp:

namespace touchgfx
{
VectorRenderer* VectorRenderer::getInstance()
{
static CWRVectorRendererRGB565 renderer;

return &renderer;
}
} // namespace touchgfx

If you have not already done so, I recommend reading this article from the TouchGFX documentation:
https://support.touchgfx.com/docs/development/scenarios/touchgfx-with-mx2.
It does not explicitly mention how to enable vector support, though.

Best regards,
Johan

2 replies

JohanAstrupBest answer
ST Technical Moderator
July 23, 2026

Hello ​@Guillaume Clouard.

As the integration of TouchGFX with STM32CubeMX2 is currently not as seamless as the integration with the original STM32CubeMX, you need to add some code manually to enable vector support. Fortunately, the code is quite simple. You need to add the following to TouchGFXGeneratedHAL.cpp:

namespace touchgfx
{
VectorRenderer* VectorRenderer::getInstance()
{
static CWRVectorRendererRGB565 renderer;

return &renderer;
}
} // namespace touchgfx

If you have not already done so, I recommend reading this article from the TouchGFX documentation:
https://support.touchgfx.com/docs/development/scenarios/touchgfx-with-mx2.
It does not explicitly mention how to enable vector support, though.

Best regards,
Johan

Associate
July 24, 2026

Hello Johan,

Thank you for your response, it indeed solved the issue.

 

Regards,

Guillaume