参考资料
FreeRTOS+LVGL移植+gui guider简单教程以及工程移植+在guider基础上绑定物理键盘
版本上V7和V8,V7和V8它们之间函数差别非常大
主流版本LVGL下载地址: LVGL8.3.10版本
操作步骤
下载解压完后的文件夹内容


其中就是这三个是需要全部加进去的,然后咱们就直接复制过来。创建examples文件夹。
打开下载的examples文件夹,要移植的仅仅是这个

这个文件夹的内容是咱们单片机上的一些接口

下载的LVGL原文件有一些测试代码,这些C代码你可以用,也可以可以留着,也可以不要。

预览下可以看到只有“lv_conf”后面的“template”是没有这个字样。所以说咱们需要把它给重命名一下,就是把后面这一些不需要的字样删掉。

在“porting”接口文件夹里面要用的文件只有四个,其他的两个删除掉,或者是在这儿放着也没事。


这两个是作为输出的接口,刷新到你屏幕上的接口。

两个是作为你的输入设备的接口
依旧是把后边“template”这些字样可以直接去掉。因为里面C程序也是没有“template”字样的。

以上基本的原文件的东西就裁剪完成了。
打开咱们的工程,在工程文件夹创建。

添加LVGL的.c文件,此步骤比较繁琐,添加src文件夹中的文件夹下里面的.c文件

添加.c文件大概有200+吧!

在conf添加.h文件


在porting添加.h文件


添加头文件路径



先编译一下,现在编译的话,因为这个东西比较大,它编译时间也会很长。而且现在他可能会有很多的报错以及warming,这些都是需要在后面做修改的。
修改.c文件的名字和开启条件使能


修改.h文件的名字


还有注意的是如果你的文件名跟着有出入的话,然后你这里添加这个路径的话,它会找不到。所以说咱们也是将这个路径删掉。


首先是对内存上裁剪,这里是它缓冲区的一个内存。原参数它内存是比较大的。咱们可以根据自己的需求进行修改。

修改完成后编译一下。可能会报错报错位置如下:

这个是屏幕的尺寸的,就是一些信息。然后这些它是没有加宏定义的,需要你自己去添加。

#ifndef MY_DISP_HOR_RES
#warning Please define or replace the macro MY_DISP_HOR_RES with the actual screen width, default value 320 is used for now.
#define MY_DISP_HOR_RES 800
#endif
#ifndef MY_DISP_VER_RES
#warning Please define or replace the macro MY_DISP_HOR_RES with the actual screen height, default value 240 is used for now.
#define MY_DISP_VER_RES 480
#endif
#define LV_VER_RES_MAX MY_DISP_VER_RES
#define LV_HOR_RES_MAX MY_DISP_HOR_RES
其实它这里进行内存管理的三种方式。然后我们一般就采用第一种,可以把2和3屏蔽掉

LVGL的话,它需要一个时钟节拍去为它提供心跳,然后也是作为它的这个显示的刷新的一个驱动。因为咱们这里用的是FreeRTOS系统,如果你用裸机的话,然后你就需要加一个。在这里咱们去写一个定时器,用一个定时器为它提供固定的一毫秒的心跳,然后就是对它进行一个区动。

更改如下:

注意这里也需要使能

显示接口
在lv_port_disp.c中增加LCD驱动头文件和在lv_port_disp.c 中下面找到disp_flush函数添加画点函数


/*
函数名:disp_flush
功能:将内部缓冲区的内容刷新到显示屏上的特定区域
参数:disp_drv : 显示设备
area : 要刷新的区域,包含了填充矩形的对角坐标
color_p : 颜色数组
备注:可以使用 DMA 或者任何硬件在后台加速执行这个操作
但是,需要在刷新完成后调用函数 'lv_disp_flush_ready()'
*/
static void disp_flush(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p)
{
if(!RGB_DIR) /* 竖屏 */
{
/* LVGL 官方给出的一个打点刷新屏幕的例子 */
int32_t x;
int32_t y;
for(y = area->y1; y <= area->y2; y++)
{
for(x = area->x1; x <= area->x2; x++)
{
#if LTDC_PIXFORMAT == LTDC_PIXFORMAT_ARGB8888
ltdc_draw_point(x, y, *(uint32_t *)(uint32_t*)color_p);
#elif LTDC_PIXFORMAT_RGB565
ltdc_draw_point(x, y, *(uint16_t *)(uint32_t*)color_p);
#endif
color_p++;
}
}
}
else /* 横屏 */
{
/* 在指定区域内填充指定颜色块 */
lcd_color_fill(area->x1,area->y1,area->x2,area->y2,(uint16_t*)color_p);
}
/* 重要!!!
* 通知图形库,已经刷新完毕了 */
lv_disp_flush_ready(disp_drv);
}
输入设备接口
输入设备的接口输入设备的话它它有多种接入方式,它有多种方式,这是触屏的鼠标、键盘。然后编码器就是那种比如说旋转的那种编码器,然后这个是物理按键,其中键盘和物理按键是有区别的。但是其实物理按键能实现的键盘都可以实现。

在lv_port_indev_init函数只保留摸屏输入设备初始化
/*
函数名:lv_port_indev_init
功能:初始化并注册输入设备
备注:无
*/
void lv_port_indev_init(void)
{
/**
*
* 在这里你可以找到 LittlevGL 支持的出入设备的实现示例:
* - 触摸屏
* - 鼠标 (支持光标)
* - 键盘 (仅支持按键的 GUI 用法)
* - 编码器 (支持的 GUI 用法仅包括: 左, 右, 按下)
* - 按钮 (按下屏幕上指定点的外部按钮)
*
* 函数 `..._read()` 只是示例
* 你需要根据具体的硬件来完成这些函数
*/
static lv_indev_drv_t indev_drv;
/*------------------
* 触摸屏
* -----------------*/
/* 初始化触摸屏(如果有) */
touchpad_init();
/* 注册触摸屏输入设备 */
lv_indev_drv_init(&indev_drv);
indev_drv.type = LV_INDEV_TYPE_POINTER;
indev_drv.read_cb = touchpad_read;
indev_touchpad = lv_indev_drv_register(&indev_drv);
/*------------------
* 鼠标
* -----------------*/
/* 初始化鼠标(如果有) */
// mouse_init();
// /* 注册鼠标输入设备 */
// lv_indev_drv_init(&indev_drv);
// indev_drv.type = LV_INDEV_TYPE_POINTER;
// indev_drv.read_cb = mouse_read;
// indev_mouse = lv_indev_drv_register(&indev_drv);
// /* 设置光标,为了简单起见,现在设置为一个 HOME 符号 */
// lv_obj_t * mouse_cursor = lv_img_create(lv_scr_act());
// lv_img_set_src(mouse_cursor, LV_SYMBOL_HOME);
// lv_indev_set_cursor(indev_mouse, mouse_cursor);
// /*------------------
// * 键盘
// * -----------------*/
// /* 初始化键盘(如果有) */
// keypad_init();
// /* 注册键盘输入设备 */
// lv_indev_drv_init(&indev_drv);
// indev_drv.type = LV_INDEV_TYPE_KEYPAD;
// indev_drv.read_cb = keypad_read;
// indev_keypad = lv_indev_drv_register(&indev_drv);
// /* 接着你需要用 `lv_group_t * group = lv_group_create()` 来创建组
// * 用 `lv_group_add_obj(group, obj)` 往组中添加物体
// * 并将这个输入设备分配到组中,以导航到它:
// * `lv_indev_set_group(indev_keypad, group);` */
// /*------------------
// * 编码器
// * -----------------*/
// /* 初始化编码器(如果有) */
// encoder_init();
// /* 注册编码器输入设备 */
// lv_indev_drv_init(&indev_drv);
// indev_drv.type = LV_INDEV_TYPE_ENCODER;
// indev_drv.read_cb = encoder_read;
// indev_encoder = lv_indev_drv_register(&indev_drv);
// /* 接着你需要用 `lv_group_t * group = lv_group_create()` 来创建组
// * 用 `lv_group_add_obj(group, obj)` 往组中添加物体
// * 并将这个输入设备分配到组中,以导航到它:
// * `lv_indev_set_group(indev_keypad, group);` */
// /*------------------
// * 按钮
// * -----------------*/
// /* 初始化按钮(如果有) */
// button_init();
// /* 注册按钮输入设备 */
// lv_indev_drv_init(&indev_drv);
// indev_drv.type = LV_INDEV_TYPE_BUTTON;
// indev_drv.read_cb = button_read;
// indev_button = lv_indev_drv_register(&indev_drv);
// /* 为按钮分配屏幕上的点
// * 以此来用按钮模拟点击屏幕上对应的点 */
// static const lv_point_t btn_points[2] = {
// {10, 10}, /*Button 0 -> x:10; y:10*/
// {40, 100}, /*Button 1 -> x:40; y:100*/
// };
// lv_indev_set_button_points(indev_button, btn_points);
}
/*
函数名:touchpad_read
功能:图形库的触摸屏读取回调函数
参数:indev_drv : 触摸屏设备
data : 输入设备数据结构体
备注:无
*/
static void touchpad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data)
{
static lv_coord_t last_x = 0;
static lv_coord_t last_y = 0;
if(tp_dev.sta&TP_PRES_DOWN)
{
last_x = tp_dev.x[0];
last_y = tp_dev.y[0];
data->point.x = last_x;
data->point.y = last_y;
data->state = LV_INDEV_STATE_PR;
}
else
{
data->point.x = last_x;
data->point.y = last_y;
data->state = LV_INDEV_STATE_REL;
}
}
lv_port_indev_templ.c整体代码
/**
* @file lv_port_indev_templ.c
*
*/
/*Copy this file as "lv_port_indev.c" and set this value to "1" to enable content*/
#if 1
/*********************
* INCLUDES
*********************/
#include "lv_port_indev.h"
#include "lvgl.h"
/* 导入驱动头文件 */
#include "./BSP/TOUCH/touch.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* STATIC PROTOTYPES
**********************/
static void touchpad_init(void);
static void touchpad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data);
//static bool touchpad_is_pressed(void);
//static void touchpad_get_xy(lv_coord_t * x, lv_coord_t * y);
//static void mouse_init(void);
//static void mouse_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data);
//static bool mouse_is_pressed(void);
//static void mouse_get_xy(lv_coord_t * x, lv_coord_t * y);
//static void keypad_init(void);
//static void keypad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data);
//static uint32_t keypad_get_key(void);
//static void encoder_init(void);
//static void encoder_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data);
//static void encoder_handler(void);
//static void button_init(void);
//static void button_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data);
//static int8_t button_get_pressed_id(void);
//static bool button_is_pressed(uint8_t id);
/**********************
* STATIC VARIABLES
**********************/
lv_indev_t * indev_touchpad;
//lv_indev_t * indev_mouse;
//lv_indev_t * indev_keypad;
//lv_indev_t * indev_encoder;
//lv_indev_t * indev_button;
//static int32_t encoder_diff;
//static lv_indev_state_t encoder_state;
/**********************
* MACROS
**********************/
/**********************
* GLOBAL FUNCTIONS
**********************/
//void lv_port_indev_init(void)
//{
// /**
// * Here you will find example implementation of input devices supported by LittelvGL:
// * - Touchpad
// * - Mouse (with cursor support)
// * - Keypad (supports GUI usage only with key)
// * - Encoder (supports GUI usage only with: left, right, push)
// * - Button (external buttons to press points on the screen)
// *
// * The `..._read()` function are only examples.
// * You should shape them according to your hardware
// */
// static lv_indev_drv_t indev_drv;
// /*------------------
// * Touchpad
// * -----------------*/
// /*Initialize your touchpad if you have*/
// touchpad_init();
// /*Register a touchpad input device*/
// lv_indev_drv_init(&indev_drv);
// indev_drv.type = LV_INDEV_TYPE_POINTER;
// indev_drv.read_cb = touchpad_read;
// indev_touchpad = lv_indev_drv_register(&indev_drv);
// /*------------------
// * Mouse
// * -----------------*/
// /*Initialize your mouse if you have*/
// mouse_init();
// /*Register a mouse input device*/
// lv_indev_drv_init(&indev_drv);
// indev_drv.type = LV_INDEV_TYPE_POINTER;
// indev_drv.read_cb = mouse_read;
// indev_mouse = lv_indev_drv_register(&indev_drv);
// /*Set cursor. For simplicity set a HOME symbol now.*/
// lv_obj_t * mouse_cursor = lv_img_create(lv_scr_act());
// lv_img_set_src(mouse_cursor, LV_SYMBOL_HOME);
// lv_indev_set_cursor(indev_mouse, mouse_cursor);
// /*------------------
// * Keypad
// * -----------------*/
// /*Initialize your keypad or keyboard if you have*/
// keypad_init();
// /*Register a keypad input device*/
// lv_indev_drv_init(&indev_drv);
// indev_drv.type = LV_INDEV_TYPE_KEYPAD;
// indev_drv.read_cb = keypad_read;
// indev_keypad = lv_indev_drv_register(&indev_drv);
// /*Later you should create group(s) with `lv_group_t * group = lv_group_create()`,
// *add objects to the group with `lv_group_add_obj(group, obj)`
// *and assign this input device to group to navigate in it:
// *`lv_indev_set_group(indev_keypad, group);`*/
// /*------------------
// * Encoder
// * -----------------*/
// /*Initialize your encoder if you have*/
// encoder_init();
// /*Register a encoder input device*/
// lv_indev_drv_init(&indev_drv);
// indev_drv.type = LV_INDEV_TYPE_ENCODER;
// indev_drv.read_cb = encoder_read;
// indev_encoder = lv_indev_drv_register(&indev_drv);
// /*Later you should create group(s) with `lv_group_t * group = lv_group_create()`,
// *add objects to the group with `lv_group_add_obj(group, obj)`
// *and assign this input device to group to navigate in it:
// *`lv_indev_set_group(indev_encoder, group);`*/
// /*------------------
// * Button
// * -----------------*/
// /*Initialize your button if you have*/
// button_init();
// /*Register a button input device*/
// lv_indev_drv_init(&indev_drv);
// indev_drv.type = LV_INDEV_TYPE_BUTTON;
// indev_drv.read_cb = button_read;
// indev_button = lv_indev_drv_register(&indev_drv);
// /*Assign buttons to points on the screen*/
// static const lv_point_t btn_points[2] = {
// {10, 10}, /*Button 0 -> x:10; y:10*/
// {40, 100}, /*Button 1 -> x:40; y:100*/
// };
// lv_indev_set_button_points(indev_button, btn_points);
//}
/*
函数名:lv_port_indev_init
功能:初始化并注册输入设备
备注:无
*/
void lv_port_indev_init(void)
{
/**
*
* 在这里你可以找到 LittlevGL 支持的出入设备的实现示例:
* - 触摸屏
* - 鼠标 (支持光标)
* - 键盘 (仅支持按键的 GUI 用法)
* - 编码器 (支持的 GUI 用法仅包括: 左, 右, 按下)
* - 按钮 (按下屏幕上指定点的外部按钮)
*
* 函数 `..._read()` 只是示例
* 你需要根据具体的硬件来完成这些函数
*/
static lv_indev_drv_t indev_drv;
/*------------------
* 触摸屏
* -----------------*/
/* 初始化触摸屏(如果有) */
touchpad_init();
/* 注册触摸屏输入设备 */
lv_indev_drv_init(&indev_drv);
indev_drv.type = LV_INDEV_TYPE_POINTER;
indev_drv.read_cb = touchpad_read;
indev_touchpad = lv_indev_drv_register(&indev_drv);
/*------------------
* 鼠标
* -----------------*/
/* 初始化鼠标(如果有) */
// mouse_init();
// /* 注册鼠标输入设备 */
// lv_indev_drv_init(&indev_drv);
// indev_drv.type = LV_INDEV_TYPE_POINTER;
// indev_drv.read_cb = mouse_read;
// indev_mouse = lv_indev_drv_register(&indev_drv);
// /* 设置光标,为了简单起见,现在设置为一个 HOME 符号 */
// lv_obj_t * mouse_cursor = lv_img_create(lv_scr_act());
// lv_img_set_src(mouse_cursor, LV_SYMBOL_HOME);
// lv_indev_set_cursor(indev_mouse, mouse_cursor);
// /*------------------
// * 键盘
// * -----------------*/
// /* 初始化键盘(如果有) */
// keypad_init();
// /* 注册键盘输入设备 */
// lv_indev_drv_init(&indev_drv);
// indev_drv.type = LV_INDEV_TYPE_KEYPAD;
// indev_drv.read_cb = keypad_read;
// indev_keypad = lv_indev_drv_register(&indev_drv);
// /* 接着你需要用 `lv_group_t * group = lv_group_create()` 来创建组
// * 用 `lv_group_add_obj(group, obj)` 往组中添加物体
// * 并将这个输入设备分配到组中,以导航到它:
// * `lv_indev_set_group(indev_keypad, group);` */
// /*------------------
// * 编码器
// * -----------------*/
// /* 初始化编码器(如果有) */
// encoder_init();
// /* 注册编码器输入设备 */
// lv_indev_drv_init(&indev_drv);
// indev_drv.type = LV_INDEV_TYPE_ENCODER;
// indev_drv.read_cb = encoder_read;
// indev_encoder = lv_indev_drv_register(&indev_drv);
// /* 接着你需要用 `lv_group_t * group = lv_group_create()` 来创建组
// * 用 `lv_group_add_obj(group, obj)` 往组中添加物体
// * 并将这个输入设备分配到组中,以导航到它:
// * `lv_indev_set_group(indev_keypad, group);` */
// /*------------------
// * 按钮
// * -----------------*/
// /* 初始化按钮(如果有) */
// button_init();
// /* 注册按钮输入设备 */
// lv_indev_drv_init(&indev_drv);
// indev_drv.type = LV_INDEV_TYPE_BUTTON;
// indev_drv.read_cb = button_read;
// indev_button = lv_indev_drv_register(&indev_drv);
// /* 为按钮分配屏幕上的点
// * 以此来用按钮模拟点击屏幕上对应的点 */
// static const lv_point_t btn_points[2] = {
// {10, 10}, /*Button 0 -> x:10; y:10*/
// {40, 100}, /*Button 1 -> x:40; y:100*/
// };
// lv_indev_set_button_points(indev_button, btn_points);
}
/**********************
* STATIC FUNCTIONS
**********************/
/*------------------
* Touchpad
* -----------------*/
/*Initialize your touchpad*/
static void touchpad_init(void)
{
/*Your code comes here*/
}
/*
函数名:touchpad_read
功能:图形库的触摸屏读取回调函数
参数:indev_drv : 触摸屏设备
data : 输入设备数据结构体
备注:无
*/
static void touchpad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data)
{
static lv_coord_t last_x = 0;
static lv_coord_t last_y = 0;
if(tp_dev.sta&TP_PRES_DOWN)
{
last_x = tp_dev.x[0];
last_y = tp_dev.y[0];
data->point.x = last_x;
data->point.y = last_y;
data->state = LV_INDEV_STATE_PR;
}
else
{
data->point.x = last_x;
data->point.y = last_y;
data->state = LV_INDEV_STATE_REL;
}
}
/*Will be called by the library to read the touchpad*/
//static void touchpad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data)
//{
// static lv_coord_t last_x = 0;
// static lv_coord_t last_y = 0;
// /*Save the pressed coordinates and the state*/
// if(touchpad_is_pressed()) {
// touchpad_get_xy(&last_x, &last_y);
// data->state = LV_INDEV_STATE_PR;
// }
// else {
// data->state = LV_INDEV_STATE_REL;
// }
// /*Set the last pressed coordinates*/
// data->point.x = last_x;
// data->point.y = last_y;
//}
///*Return true is the touchpad is pressed*/
//static bool touchpad_is_pressed(void)
//{
// /*Your code comes here*/
// return false;
//}
///*Get the x and y coordinates if the touchpad is pressed*/
//static void touchpad_get_xy(lv_coord_t * x, lv_coord_t * y)
//{
// /*Your code comes here*/
// (*x) = 0;
// (*y) = 0;
//}
///*------------------
// * Mouse
// * -----------------*/
///*Initialize your mouse*/
//static void mouse_init(void)
//{
// /*Your code comes here*/
//}
///*Will be called by the library to read the mouse*/
//static void mouse_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data)
//{
// /*Get the current x and y coordinates*/
// mouse_get_xy(&data->point.x, &data->point.y);
// /*Get whether the mouse button is pressed or released*/
// if(mouse_is_pressed()) {
// data->state = LV_INDEV_STATE_PR;
// }
// else {
// data->state = LV_INDEV_STATE_REL;
// }
//}
///*Return true is the mouse button is pressed*/
//static bool mouse_is_pressed(void)
//{
// /*Your code comes here*/
// return false;
//}
///*Get the x and y coordinates if the mouse is pressed*/
//static void mouse_get_xy(lv_coord_t * x, lv_coord_t * y)
//{
// /*Your code comes here*/
// (*x) = 0;
// (*y) = 0;
//}
///*------------------
// * Keypad
// * -----------------*/
///*Initialize your keypad*/
//static void keypad_init(void)
//{
// /*Your code comes here*/
//}
///*Will be called by the library to read the mouse*/
//static void keypad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data)
//{
// static uint32_t last_key = 0;
// /*Get the current x and y coordinates*/
// mouse_get_xy(&data->point.x, &data->point.y);
// /*Get whether the a key is pressed and save the pressed key*/
// uint32_t act_key = keypad_get_key();
// if(act_key != 0) {
// data->state = LV_INDEV_STATE_PR;
// /*Translate the keys to LVGL control characters according to your key definitions*/
// switch(act_key) {
// case 1:
// act_key = LV_KEY_NEXT;
// break;
// case 2:
// act_key = LV_KEY_PREV;
// break;
// case 3:
// act_key = LV_KEY_LEFT;
// break;
// case 4:
// act_key = LV_KEY_RIGHT;
// break;
// case 5:
// act_key = LV_KEY_ENTER;
// break;
// }
// last_key = act_key;
// }
// else {
// data->state = LV_INDEV_STATE_REL;
// }
// data->key = last_key;
//}
///*Get the currently being pressed key. 0 if no key is pressed*/
//static uint32_t keypad_get_key(void)
//{
// /*Your code comes here*/
// return 0;
//}
///*------------------
// * Encoder
// * -----------------*/
///*Initialize your keypad*/
//static void encoder_init(void)
//{
// /*Your code comes here*/
//}
///*Will be called by the library to read the encoder*/
//static void encoder_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data)
//{
// data->enc_diff = encoder_diff;
// data->state = encoder_state;
//}
///*Call this function in an interrupt to process encoder events (turn, press)*/
//static void encoder_handler(void)
//{
// /*Your code comes here*/
// encoder_diff += 0;
// encoder_state = LV_INDEV_STATE_REL;
//}
///*------------------
// * Button
// * -----------------*/
///*Initialize your buttons*/
//static void button_init(void)
//{
// /*Your code comes here*/
//}
///*Will be called by the library to read the button*/
//static void button_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data)
//{
// static uint8_t last_btn = 0;
// /*Get the pressed button's ID*/
// int8_t btn_act = button_get_pressed_id();
// if(btn_act >= 0) {
// data->state = LV_INDEV_STATE_PR;
// last_btn = btn_act;
// }
// else {
// data->state = LV_INDEV_STATE_REL;
// }
// /*Save the last pressed button's ID*/
// data->btn_id = last_btn;
//}
///*Get ID (0, 1, 2 ..) of the pressed button*/
//static int8_t button_get_pressed_id(void)
//{
// uint8_t i;
// /*Check to buttons see which is being pressed (assume there are 2 buttons)*/
// for(i = 0; i < 2; i++) {
// /*Return the pressed button's ID*/
// if(button_is_pressed(i)) {
// return i;
// }
// }
// /*No button pressed*/
// return -1;
//}
///*Test if `id` button is pressed or not*/
//static bool button_is_pressed(uint8_t id)
//{
// /*Your code comes here*/
// return false;
//}
#else /*Enable this file at the top*/
/*This dummy typedef exists purely to silence -Wpedantic.*/
typedef int keep_pedantic_happy;
#endif

最后在魔法棒点进去后选择C/C++将C99模式一定要勾上。
编译一下,应该是没有报错了。

910

被折叠的 条评论
为什么被折叠?



