问题描述
我在 MPLAB X IDE v5.45 下使用 AVR GCC 编译器 v5.4.0。
我在 avr-as-pre
部分为编译器定义了一个符号。它将以下内容添加到调用的命令中:
-DF_cpu=32000000UL
#ifndef F_cpu
// do something
它实际上做了某事。看起来好像没有找到符号。 如何以这种方式为整个项目定义一个符号,我错了吗?
更新
IDE 将这些东西称为“定义的符号”:
但它实际上将它们存储为“预处理器宏”:
<AVR-AS-PRE>
<property key="announce-version" value="false"/>
<property key="include-paths" value=""/>
<property key="preprocessor-macros" value="F_cpu=32000000UL"/>
<property key="preprocessor-macros-undefined" value=""/>
<property key="suppress-warnings" value="false"/>
</AVR-AS-PRE>
不幸的是,它似乎没有将它们传递给编译器:
$ grep -nrw . -e F_cpu
./nbproject/configurations.xml:117: <property key="preprocessor-macros" value="F_cpu=32000000UL"/>