I have seen in many codes that structure like following is using :
#ifdef something
...
#endif
Where can I set up "something"? I use CodeBlocks. Thank you!
# | User | Rating |
---|---|---|
1 | tourist | 3880 |
2 | jiangly | 3669 |
3 | ecnerwala | 3654 |
4 | Benq | 3627 |
5 | orzdevinwang | 3612 |
6 | Geothermal | 3569 |
6 | cnnfls_csy | 3569 |
8 | jqdai0815 | 3532 |
9 | Radewoosh | 3522 |
10 | gyh20 | 3447 |
# | User | Contrib. |
---|---|---|
1 | awoo | 161 |
2 | maomao90 | 160 |
3 | adamant | 156 |
4 | maroonrk | 153 |
5 | -is-this-fft- | 148 |
5 | SecondThread | 148 |
5 | atcoder_official | 148 |
8 | Petr | 147 |
9 | nor | 144 |
9 | TheScrasse | 144 |
I have seen in many codes that structure like following is using :
#ifdef something
...
#endif
Where can I set up "something"? I use CodeBlocks. Thank you!
Name |
---|
This can be done in the compiler settings of your IDE. Usually they allow you to pass some arguments to the compiler invocation. You need to pass the argument:
-D something
you could enable by putting #define something 1 before that #ifdef :
This is a simple example for
#ifdef
,#ifndef
and#else
you can also have#elif
which works likeelse if
and there is#if
that works likeif
;For Codeblocks: Settings -> Compiler.
If you invoke gcc manually:
g++ -DSOMETHING ...