Error of font on porting lvgl to linux framebuffer

I did the setup of lvgl and call lv_demo_music()

	lv_init();

	/* lvgl display buffer */
	static lv_disp_buf_t disp_buf;
	/* Declare a buffer for 1/10 screen size */
	static lv_color_t buf[LV_HOR_RES_MAX * LV_VER_RES_MAX /10];
	/* Initialize the display buffer */
	lv_disp_buf_init(&disp_buf, buf, NULL, LV_HOR_RES_MAX * LV_VER_RES_MAX /10);
	
	lv_disp_drv_t disp_drv;
	lv_disp_drv_init(&disp_drv);
	disp_drv.flush_cb = my_disp_flush;
	disp_drv.buffer = &disp_buf;
	lv_disp_drv_register(&disp_drv);

	lv_indev_drv_t indev_drv;
	lv_indev_drv_init(&indev_drv);

	indev_drv.type = LV_INDEV_TYPE_POINTER;
	indev_drv.read_cb = my_touchpad_read;
	lv_indev_drv_register(&indev_drv); 

	/* APP */
	lv_demo_music();
	
	while(1) {
		lv_task_handler();
		usleep(5000);
		lv_tick_inc(5*1000);
	}

All of the source file has been successfully compile except lv_demo_music_main.c

Here the one of error that compiler thrown out, other error same as this

lv_examples/src/lv_demo_music/lv_demo_music_main.c: In function ‘_lv_demo_music_main_create’:
lv_examples/src/lv_demo_music/lv_demo_music_main.c:96:19: error: ‘lv_font_montserrat_12’ undeclared (first use in this function); did you mean ‘lv_font_montserrat_14’?
     font_small = &lv_font_montserrat_12;
                   ^~~~~~~~~~~~~~~~~~~~~
                   lv_font_montserrat_14

The question is ,whichever demo i called,the compiler will throw out the same error

What should i do, i dont konw a way to resolve this.Thanks

Lately I successfully compiled lv_demo_widgets, it runs good but some mistake with color, such as gray to dark yellow, sky blue to red, unfortunately as now i didn’t know what cause it.

Im thinking about is these options caused lv_demo_music compile failed?

#define LV_FONT_MONTSERRAT_8     0
#define LV_FONT_MONTSERRAT_10    0
#define LV_FONT_MONTSERRAT_12    0
#define LV_FONT_MONTSERRAT_14    1
#define LV_FONT_MONTSERRAT_16    0
#define LV_FONT_MONTSERRAT_18    0
#define LV_FONT_MONTSERRAT_20    0
#define LV_FONT_MONTSERRAT_22    0
#define LV_FONT_MONTSERRAT_24    0
#define LV_FONT_MONTSERRAT_26    0
#define LV_FONT_MONTSERRAT_28    0
#define LV_FONT_MONTSERRAT_30    0
#define LV_FONT_MONTSERRAT_32    0
#define LV_FONT_MONTSERRAT_34    0
#define LV_FONT_MONTSERRAT_36    0
#define LV_FONT_MONTSERRAT_38    0
#define LV_FONT_MONTSERRAT_40    0
#define LV_FONT_MONTSERRAT_42    0
#define LV_FONT_MONTSERRAT_44    0
#define LV_FONT_MONTSERRAT_46    0
#define LV_FONT_MONTSERRAT_48    0

I change the value of marco try to if could enabled it
And the lv_demo_printer could be compile, seems when you want to use the lv_font , you should toggle of these marcos to enable it.

Solution Here

if you have same error with me

  1. check the lv_conf.h and jump to here
/*==================
 *    FONT USAGE
 *===================*/

/* The built-in fonts contains the ASCII range and some Symbols with  4 bit-per-pixel.
 * The symbols are available via `LV_SYMBOL_...` defines
 * More info about fonts: https://docs.lvgl.io/v7/en/html/overview/font.html
 * To create a new font go to: https://lvgl.com/ttf-font-to-c-array
 */

/* Montserrat fonts with bpp = 4
 * https://fonts.google.com/specimen/Montserrat  */
#define LV_FONT_MONTSERRAT_8  1
....
  1. change the value of marco from 0 to 1 could enable the font

Font Error when compiling LVGL library :
Arduino\libraries\lv_examples\src\lv_demo_music\lv_demo_music_list.c: In function ‘_lv_demo_music_list_create’:
Arduino\libraries\lv_examples\src\lv_demo_music\lv_demo_music_list.c:59:19: error: ‘lv_font_montserrat_12’ undeclared (first use in this function); did you mean ‘lv_font_montserrat_14’?
font_small = &lv_font_montserrat_12;
^~~~~~~~~~~~~~~~~~~~~
lv_font_montserrat_14
Arduino\libraries\lv_examples\src\lv_demo_music\lv_demo_music_list.c:59:19: note: each undeclared identifier is reported only once for each function it appears in
Arduino\libraries\lv_examples\src\lv_demo_music\lv_demo_music_list.c:60:20: error: ‘lv_font_montserrat_16’ undeclared (first use in this function); did you mean ‘lv_font_montserrat_14’?
font_medium = &lv_font_montserrat_16;
^~~~~~~~~~~~~~~~~~~~~
lv_font_montserrat_14
Arduino\libraries\lv_examples\src\lv_demo_music\lv_demo_music_main.c: In function ‘_lv_demo_music_main_create’:
Arduino\libraries\lv_examples\src\lv_demo_music\lv_demo_music_main.c:111:19: error: ‘lv_font_montserrat_12’ undeclared (first use in this function); did you mean ‘lv_font_montserrat_14’?
font_small = &lv_font_montserrat_12;
^~~~~~~~~~~~~~~~~~~~~
lv_font_montserrat_14
Arduino\libraries\lv_examples\src\lv_demo_music\lv_demo_music_main.c:111:19: note: each undeclared identifier is reported only once for each function it appears in
Arduino\libraries\lv_examples\src\lv_demo_music\lv_demo_music_main.c:112:19: error: ‘lv_font_montserrat_16’ undeclared (first use in this function); did you mean ‘lv_font_montserrat_14’?
font_large = &lv_font_montserrat_16;
^~~~~~~~~~~~~~~~~~~~~
lv_font_montserrat_14
if we look at the error carefully we find out the LVGL Example need 3 type of fonts in the function.1 is default font which is named “LV_FONT_MONTSERRAT_14”. compiler ask about two other font (“lv_font_montserrat_12” which is used in ‘_lv_demo_music_list_create’ and the other is used in ‘_lv_demo_music_main_create’ and ect. ). So to fix this error we should enable “LV_FONT_MONTSERRAT_12” and “LV_FONT_MONTSERRAT_16”
Enabling Fonts steps in header file:
1 step → open “lv_conf.h”
2- change-> #define LV_FONT_MONTSERRAT_12 0 ----> #define LV_FONT_MONTSERRAT_12 1
3-change #define LV_FONT_MONTSERRAT_14 0 -------> #define LV_FONT_MONTSERRAT_14 1
4-change #define LV_FONT_MONTSERRAT_16 0 -------> #define LV_FONT_MONTSERRAT_16 1
5-Save the file and close it.
6-compile your code.