Skip to main content
Wwang.204
Associate
Dec 8, 2021 11:46 AM UTC
Question

Touchgfx simulator compile error: 'touchgfx_printf' was not declared in this scope

Add debug log in my "Screen1View.cpp" , but report error log as below :

    Compiling gui/src/screen1_screen/Screen1View.cpp

    gui/src/screen1_screen/Screen1View.cpp: In member function 'virtual void Screen1View::buttonUpClicked()':

    gui/src/screen1_screen/Screen1View.cpp:19:3: error: 'touchgfx_printf' was not declared in this scope

      touchgfx_printf("buttonUpClicked\n");

Source code :

\TouchGFX\gui\src\screen1_screen\Screen1View.cpp

....

void Screen1View::buttonUpClicked()

{

 touchgfx_printf("buttonUpClicked\n");

}

...

If this code is commented out , Compiling will be normal .

....

void Screen1View::buttonUpClicked()

{

// touchgfx_printf("buttonUpClicked\n");

}

...

would you give me some suggestions ?

This topic has been closed for replies.

2 replies

Wwang.204
Wwang.204Author
Associate
Dec 9, 2021 1:24 AM UTC

Already fixed , just need include below :

#include <touchgfx/Utils.hpp>

Many thanks

wired
Senior II
Aug 18, 2022 4:00 PM UTC

@Romain DIELEMAN​ , the required include file should really be mentioned in the TouchGFX online documentation where the use of touchgfx_printf is described.

With over 200 views, I'm guessing a lot of people have run into this, myself included.