I'm using AVR GCC compiler v5.4.0 under MPLAB X IDE v5.45.
I defined a symbol for the compiler in the avr-as-pre section. It adds the following to the invoked command:
-DF_CPU=32000000UL
Inside the code I have some checks like this:
#ifndef F_CPU
// do something
and it actually does something. It looks like if it doesn't find the symbol. Am I wrong about how to define a symbol for the whole project in this way?
UPDATE
The IDE calls this stuff "defined symbols":
but it stores them as "preprocessor macros" actually:
<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>
Unfortunately it seems it does not pass them to the compiler:
$ grep -nrw . -e F_CPU
./nbproject/configurations.xml:117: <property key="preprocessor-macros" value="F_CPU=32000000UL"/>


-Doption is not actually making it to the compiler; I'm not familiar with this IDE so I'm not sure if where you've added this option is the right place. One note is that what you're defining is not a symbol (which is a name resolved to an address at link time) but rather a macro (which is only used in preprocessing); any chance that confusion is related?presuffix - I guessed it stands forpreprocessorbut I didn't think about theaspart!