#if (MCU_Type == STC15W_4K16S4) #define MOVC_ShiftAddress 0x4000 #elif (MCU_Type == STC15W_4K32S4) #define MOVC_ShiftAddress 0x8000 #elif (MCU_Type == STC15W_4K40S4) #define MOVC_ShiftAddress 0xA000 #elif (MCU_Type == STC15W_4K48S4) #define MOVC_ShiftAddress 0xC000 #elif (MCU_Type == STC15W_4K56S4) #define MOVC_ShiftAddress 0xE000 #elif (MCU_Type == IAP15W_4K58S4) #define MOVC_ShiftAddress 0xE000 #elif (MCU_Type == IAP15W_4K61S4) #define MOVC_ShiftAddress 0xE000 #elif (MCU_Type == IAP15W_4K63S4) #define MOVC_ShiftAddress 0xE000 #endif
在看刘平老师飞天三号EEPROM库函数中有这么一段代码,编译的时候总是报警,不知道是哪里有问题,是语法的问题么?或者是其他问题呢?
#elif (MCU_Type == IAP15W_4K58S4 ) #define MOVC_ShiftAddress 0xE000
#include "xxx.h"
error: 'IAP15W_4K58S4' undeclared (first use in this function)
LiuYang 发表于 2016-10-27 09:55 先占楼
zhangsf_chongza 发表于 2016-10-27 09:57 #define MCU_Type IAP15W_4K58S4
SingleYork 发表于 2016-10-27 10:06 这个定义了……
MOP 发表于 2016-10-27 18:33 不公平~後面都知道是我的答案了,IC比人少 哈哈
汉云 发表于 2016-10-28 11:07 看看你的回复的编辑时间,我回答时你还不是这个答案吧。
US 发表于 2016-10-28 12:15 你这问题应该是调用这个宏的位置出现问题,而非宏定义处,你可以把宏定义改成const,这样很容易找到出错位 ...
MOP 发表于 2016-10-28 13:23 那個喔,他嫌我寫太少我又補充上去,樓主知道
MOP 发表于 2016-10-28 13:29 意義上const跟#define是不同的,因為一個是"唯讀變數"當作常量,一個是"預處理"常量,正確觀念是用#define ...