Precedence of -D MACRO and #define MACRO

后端 未结 5 626
情歌与酒
情歌与酒 2021-01-11 14:24

If I have a C file foo.c and while I have given -DMACRO=1 as command line option for compilation. However, if within the header file also I hav

5条回答
  •  终归单人心
    2021-01-11 15:28

    You'll get an error for macro redefinition. Obviously -D gets defined first (before the source file is parsed rather than after) or it would have no use. The #define is then a redefinition.

提交回复
热议问题