换一种写法
#if (TP_TEST_FUNC == ENABLE)
static Ux_RECT tp_coord = {0,0, 0, 0};
void endev_get_tp_coord(PUx_RECT data)
{
data->x1 = tp_coord.x1;
data->y1 = tp_coord.y1;
}
#endif
#if (TP_TEST_FUNC == ENABLE)
Ux_RECT tp_data = {0};
endev_get_tp_coord(&tp_data);
lv_label_set_text_fmt(HomeBar_objs.tp_test_str, "( %d - %d )", tp_data.x1, tp_data.y1);
#endif
另一种报错
ui_home.c:1161:5: error: unknown type name ‘Ux_RECT’
1161 | Ux_RECT tp_data = {0};
| ^~~~~~~
ui_home.c:1163:75: error: request for member ‘x1’ in something not a structure or union
1163 | lv_label_set_text_fmt(HomeBar_objs.tp_test_str, "( %d - %d )", tp_data.x1, tp_data.y1);
| ^
ui_home.c:1163:87: error: request for member ‘y1’ in something not a structure or union
1163 | lv_label_set_text_fmt(HomeBar_objs.tp_test_str, "( %d - %d )", tp_data.x1, tp_data.y1);
|
估计是编译器找不到数据的类型了