User forums > Using Code::Blocks

Newbie confused over compiler define option


Hello, I am new to code::blocks. 

 I have a C source file with conditional code dependent upon the compiler selected.    The code may say "#If defined( __SDCC__)" and do some things, or do something else if not SDCC, or if  another compiler specified.      If there is a definition in the source file, the applicable code highlights.    In my code right now, the SDCC selection is not defined and the code I wish to execute is not highlighted.   How is the compiler selection indicated to the preprocessor at compile time?

I am concerned the SDCC compiler is executing, but not conditionally compiling my code properly.



The highlighting of #ifdef blocks is complete independent from the compiling and only visually. It does not know anything about the selected compiler. You can turn  it of in the settings if it is distracting you

Codeblocks does not define anything by default and all #ifdefs come from the compiler itself.

What exactly is your problem?

I used this feature a long time ago.

Settings -> Editor
Left Pane: General Settings
Tab: C/C++ Editor Settings
Check mark: Include Host Platform defines

That is what I think used years ago.

Tim S.


[0] Message Index

Go to full version