Including a #define in all .c source files at compile time

前端 未结 3 1675
一整个雨季
一整个雨季 2020-12-19 02:33

I need to include a #define at the top of around 300 .c files. I would prefer not to change the code as it is open source code but if I have to I will just wri

3条回答
  •  佛祖请我去吃肉
    2020-12-19 03:17

    gcc option -D:

    -D name
        Predefine name as a macro, with definition 1.
    
    -D name=definition
        ....
    

    so, in your case, gcc ... -Dmalloc=MYmalloc

提交回复
热议问题