一、lvgl模拟器添加图片,编译提示无法解析的外部符号
1. v_img_set_src(obj, &img_cogwheel_argb);
编译一下,报以下错误
错误原因是img_cogwheel_argb.c 文件中的变量img_cogwheel_argb定义按C编译
const lv_img_dsc_t img_cogwheel_argb = {
.header.always_zero = 0,
.header.w = 100,
.header.h = 100,
.data_size = 10000 * LV_IMG_PX_SIZE_ALPHA_BYTE,
.header.cf = LV_IMG_CF_TRUE_COLOR_ALPHA,
.data = img_cogwheel_argb_map,
};
而lvgl_similator.cpp中引用的img_cogwheel_argb变量按C++编译,造成名字引用找不到错误,解决方法如下:
在需要引用的
#ifndef MYFUNCTIONS_H
#define MYFUNCTIONS_H
#ifdef __cplusplus
extern "C" {
#endif
LV_IMG_DECLARE(ui_img_anim_spring_wreath_0_png); // 声明 C
#ifdef __cplusplus
}
#endif
#endif // MYFUNCTIONS_H
2.
二、模拟器版本选择V8 V9
模拟器也是可以选择版本的,直接切换到想要的分支,再更新子模块即可
https://zhuanlan.zhihu.com/p/695194026