尝试编译时在.h文件中出错。分号缺失

时间:2015-11-25 19:14:09

标签: c struct

struct MemPidsData
{
int PID[7];
}

struct MemInfoData
{
int heater;
int pump;
int fan;
int temperature;
int valve;
}
#define MEMORY_NAME_INFO "InfoMem" /* Common Memmory */
#define MEMORY_SIZE_INFO sizeof(struct MemData)
#define MEMORY_SIZE_PIDS sizeof(struct MemData)
#define MEMORY_NAME_PIDS "CommonMem" /* Common Memmory */

我收到一个错误,在定义了struct MemInfoData的行上缺少分号...请帮助..

2 个答案:

答案 0 :(得分:5)

你实际上有两个缺少分号 - 它应该是:

struct MemPidsData
{
    int PID[7];
}; // <<<

struct MemInfoData
{
    int heater;
    int pump;
    int fan;
    int temperature;
    int valve;
}; // <<<

答案 1 :(得分:3)

始终声明struct;

结尾
struct MemPidsData
{
    int PID[7];
};