事情是这个样子,小最近在练习GUI手册的例程,在第六章的2d图形库中有如下例程,完整源码如下:
上面是完整的例程。出于编写的需要,我特地把这个函数写成一个practice模块,然后再主函数调用这个例程,
模块:practice.c代码如下:
#include"practice.h"
#include "GUI.h"
//const GUI_POINT aPoints[]={
//// {0,20},
//// {40,20},
//// {20,0}
//};
GUI_POINT aEnlargedPoints[countof(aPoints)];
/* 第六章 2D图形库练习 */
void Sample(void)
{
int i;
GUI_Clear();
GUI_SetDrawMode(GUI_DM_XOR);
GUI_FillPolygon(aPoints,countof(aPoints),140,110);
for(i=1;i<10;i++)
{
GUI_EnlargePolygon(aEnlargedPoints,aPoints,countof(aPoints),i*5);
GUI_FillPolygon(aEnlargedPoints,countof(aPoints),140,110);
}
}
practice.h代码如下:
#ifndef __PRACTICE_H__
#define __PRACTICE_H__
#include "sys.h"
#include"GUI.h"
#define countof(Array) (sizeof(Array)/sizeof[Array[0]]) //求数组的长度
extern const GUI_POINT aPoints[]={
{0,20},
{40,20},
{20,0}
};
void Sample(void);
#endif
主函数代码:
#include <stm32f10x_lib.h>
#include "sys.h"
#include "usart.h"
#include "delay.h"
#include"practice.h"
//#include <math.h>
//#include"dialplate.h" /*界面接口函数*/
//#include "rtc.h" /*实时时钟*/
/*章节练习*/
#include "GUI.h"
int main(void)
{
Stm32_Clock_Init(9);//系统时钟设置
delay_init(72); //延时初始化
uart_init(72,9600); //串口1初始化
// RTC_Init();
// MainTask();
Sample();
while(1)
{
}
}
但是编译之后却出现如下警告:
貌似是在说我practice文件的某个函数需要一个符号表达,但是我go to define之后进去的gui的源文件,没发现有啥不妥,郁闷了一个晚上了,特来求助啊
|