求助!MDK中,要怎么定义全局宏?

2019-07-20 11:21发布

比如我定义了:
#define A 2
怎么使这个宏在所有工程文件中生效?
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
10条回答
aozima
2019-07-20 11:41
FORMRL 发表于 2017-10-24 12:05
可是如果我要定义#define A 2 ,这样的话,要怎么写?我试过A=2,A:2,A 2,都不对

help里面有示例

Keil EC++ Compiler
Preprocessor Symbols
Define sets preprocessor symbols, which can be checked with #if, #ifdef and #ifndef. The defined names are case-sensitive. Optionally, each name can have a value. Define: Check, NoExtRam, X1=1+5 is identical to the following C preprocessor #define statements:
#define Check
#define NoExtRam
#define X1 1+5

Undefine clears previous Define assignments that are entered in the options dialog of a higher Target or Group level.

一周热门 更多>