我在头文件(pnl.h)中这样定义:
#ifndef _PNL_H_
#define _PNL_H_
typedef struct{
void (*calc)(void*);
unsigned int rf; //Q0,给定频率
unsigned int rul; //Q0,给定输出线电压有效值
unsigned int rudc; //Q0,给定母线电压
unsigned int run; //Q0,设定
unsigned int f;
unsigned int u1_max;
unsigned int udc;
}PNL;
#define PNL_DEFAULTS{ \
(void (*)(void*))pnl_calc, \
50, \
180, \
310, \
0, \
0, \
0, \
0, \
}
typedef PNL *PNL_Handle;
void pnl_calc(PNL_Handle);
#endif
主程序(AD.C)这样用:
#include "pnl.h"
PNL pnl=PNL_DEFAULTS;
void main(void)
{
}
编译出现下面问题:
"ad.c", line 13: [F001] syntax error at or near symbol ''
"ad.c", line 13: [F001] syntax error at or near symbol ''
"ad.c", line 13: [F141] illegal function call
"ad.c", line 13: [E152] initializer for 'pnl' has incompatible type
"ad.c", line 13: [F151] non-constant initializer for 'pnl'
这是为什么??? |